Skip to content

wikimedia/wikimedia-fundraising-coworker

Repository files navigation

coworker

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.

Benefits

There are other paradigms for background processing in CiviCRM. coworker is distinct in supporting all these features simultaneously:

  • Multitasking: coworker supports parallel execution of multiples tasks from multiple queues.
  • Generic: coworker can execute diverse tasks, as defined by CiviCRM extensions. The sysadmin is not required to manually setup bespoke/per-task runners.
  • Compatible: coworker is 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: coworker can execute tasks with minimal delay (seconds or milliseconds - rather than minutes or hours).
  • Progressive enhancement: coworker is compatible with almost any CiviCRM deployment type, but it gets progressively better if the deployment's technology permits.
  • Resource limits: coworker respects 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.

Summary

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 debug to run tasks with less parallel and more debug information.

TIP: For CiviCRM administrators, consider adding a systemd unit to launch coworker.

Documentation

About

Github mirror of "wikimedia/fundraising/coworker" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published