Skip to content

Execution Modes

execution_mode

CeleryLanguage supports three execution modes:

  • local: run tasks in-process.
  • distributed: dispatch via Celery broker.
  • auto: choose behavior based on runtime context and fallbacks.

Local

Best for unit tests and quick feedback.

Properties:

  • no external broker required
  • deterministic call path
  • emits job/subjob timeline events when journal is enabled

Distributed

Best for production-like async execution.

Properties:

  • sends envelope to Celery task (lingo.execute)
  • queue selection depends on routing_mode
  • supports retry policy propagation and journaling

routing_mode

  • shared: use a shared channel queue (default lingo.default).
  • task: route by root task name; supports worker-specific task queues.

Phrase Local Placement

phrase(...).local(force=False) requests strict placement to one capable worker.

Behavior:

  • if a worker with required tasks is registered, dispatch uses that worker's private queue
  • if not found and force=False, dispatch raises
  • if force=True, runtime may fall back according to mode/path

orchestration_mode

  • simple: standard dispatch behavior.
  • compiled: compiles workflow graph for optimized lowering paths.

Compiled mode notes:

  • linear graphs can lower to Celery canvas chains
  • fan-in shapes can lower to chords
  • unsupported lowering shapes fall back to simple dispatch and emit a lowering event