This project is in an early/pre-release phase. The README gives a general overview of scope, but it may be out-of-sync with the code and depend on a mix of merged+unmerged core patches.
Civi coworker is a task runner for CiviCRM -- it allows CiviCRM to run tasks in the background.
There are other paradigms for background processing in CiviCRM. coworker is distinct in supporting all these features simultaneously:
- Multitasking:
coworkersupports parallel execution of multiples tasks from multiple queues. - Generic:
coworkercan execute diverse tasks, as defined by CiviCRM extensions. The sysadmin is not required to manually setup bespoke/per-task runners. - Compatible:
coworkeris compatible with several deployment topologies - such as dedicated hosts, cloud hosts, and local hosts. Coworker uses local processes, SSH connections, and (todo) HTTP(S) connections. - Performant:
coworkercan execute tasks with minimal delay (seconds or milliseconds - rather than minutes or hours). - Progressive enhancement:
coworkeris compatible with almost any CiviCRM deployment type, but it gets progressively better if the deployment's technology permits. - Resource limits:
coworkerrespects multiple resource limits, such as #workers, worker-lifetime, and #requests-per-worker. - Redundancy: A single CiviCRM deployment can have multiple
coworkers. If one goes offline, the others continue.
The basic process is to download coworker and start the command coworker run, e.g.
## Usage
coworker run [CONNECTION_OPTIONS]
## Examples
coworker run
coworker run --cwd=/var/www/example.com
coworker run --pipe='drush @example.com ev "civicrm_initialize(); Civi::pipe();"'
coworker run --web='https://example.com/civicrm/queue?token=XXX'By default, coworker run will attempt to auto-detect a local CiviCRM instance from the current folder (based on cv bootstrap
process). However, you may need to configure the CONNECTION_OPTIONS -- especially if
using a multisite CMS or connecting to a remote server.
If the connection succeeds, then coworker will monitor CiviCRM for new tasks and execute them.
TIP: For CiviCRM developers, consider using
coworker debugto run tasks with less parallel and more debug information.TIP: For CiviCRM administrators, consider adding a
systemdunit to launchcoworker.