Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This module provides an advanced batching API. It doesn't extends core capabilities, it creates a new one, complete, more predictable and static, fully object oriented.

This API is based on the fact that batches may be run in different environments (CLI custom script, Drush, Batch API) and abstract all concepts to the higher level possible.

Concepts and design

It abstract those fundamental concepts:

Batch
The batch is a long run administration, maintenance or business script, nothing new compared to actual core API batch. A batch respond to a full workflow, from queued to finished or erroenous states. While running, it can be either running (using a runner) either stalled, which is an intermediate state during which the batch is actually waiting for being resumed automatically. Batches can also be paused by the site administrator during the execution for later resuming.
Runner
The runner is an helper object that is responsible for running a Batch. It can be run in different environments easily without worrying about external world. It is able to incrementally run the batches operations, chunked by small lot of operations, and limit its run time following arbitrary time values given.
Task
A task is the representation of a runner and batch couple state at a certain point in time. It allows to create fully featured static administration reports. It fits well with through-the-web administration pages. It provides some state reading helpers and is accompagned by persistence accessors for easy queue listing and task retrieval.
Backend
Last, but not least, the backend -or low level runner- represents a specific environment that is able to run long run batches. It can be either the actual Batch API, Drush, or custom PHP deamon on system side. Goal of abstracting this concept is to allow the site administrator to choose the way its batches should be run independently of their implementation.

Status

The administration UI is now only consultative, but is able to provide full queue listing, with tasks complete status report. The only low level runner implementation is Drush right now, a custom PHP deamon with forking and number of fork control will come shortly (port of the legacy CLI deamon module) as well as a support for Drupal core batch API to be able to run advanced batches.

While this is not mandatory and batches can be fully spawned pragmatically, modules can define default batches the site administrator can run on-demand.

A future feature will be recurring batches: modules will be able to define recurring long term batches needed to be run, and site administrator will be able to schedule them using the low level runner backend of their choice.

Project information