Executors¶
Executors control how intents are dispatched. Pass to airlock.scope(executor=...).
from airlock.integrations.executors.sync import sync_executor
from airlock.integrations.executors.celery import celery_executor
from airlock.integrations.executors.django_q import django_q_executor
from airlock.integrations.executors.django_tasks import django_tasks_executor
from airlock.integrations.executors.huey import huey_executor
from airlock.integrations.executors.dramatiq import dramatiq_executor
sync_executor¶
sync_executor ¶
Execute intent synchronously by calling the task directly.
This is the simplest executor - no queue, no threading, just immediate execution. Dispatch options are ignored.
celery_executor¶
celery_executor ¶
Execute intent via Celery task queue.
Passes dispatch_options directly to apply_async() or ignores them
for .delay(). Falls back to synchronous execution for plain callables.
django_q_executor¶
django_q_executor ¶
Execute intent via django-q's async_task().
Passes dispatch_options directly to async_task() as keyword arguments.
django_tasks_executor¶
django_tasks_executor ¶
Execute intent via Django's built-in tasks framework.
Passes dispatch_options to the task's .using() method for configuration
of priority, run_after, queue_name, and backend options.
Falls back to synchronous execution for plain callables.
Supported dispatch_options:
priority: Integer between -100 and 100 (higher = higher priority)run_after: datetime for deferred executionqueue_name: Specific queue for task executionbackend: Backend name fromTASKSconfiguration
huey_executor¶
huey_executor ¶
Execute intent via Huey task queue.
Passes dispatch_options directly to schedule() as keyword arguments.
Falls back to synchronous execution for plain callables.
dramatiq_executor¶
dramatiq_executor ¶
Execute intent via Dramatiq task queue.
Passes dispatch_options directly to send_with_options() or ignores
them for .send(). Falls back to synchronous execution for plain callables.
Writing Custom Executors¶
An executor is simply a callable that accepts an Intent:
def my_executor(intent: Intent) -> None:
"""Execute an intent."""
intent.task(*intent.args, **intent.kwargs)
See Custom Executors for examples.