Import and export backends
| Backend | Enum | Behaviour |
|---|---|---|
| Inline | INLINE | Runs in the request process |
| Python queue | PYTHON_QUEUE | Process-local worker queue |
| Background worker | WORKER | The project-selected worker provider |
WORKER retains stored value 3; CELERY is a compatibility alias. Forms
and ExecutionBackendSelect have one is_available and choice_value,
without provider-specific flags. Unavailable execution is disabled and rejected
on POST. A configured worker is the default; otherwise Python queue is used.
Common task mechanism
Added in 1.0.19Import/export uses the same background task protocol
as every other Chassis task. ImportExportDispatchService saves history and
passes the task definition and JSON arguments to WorkerService. The shared
service selects the provider and publishes after commit. Neither the handler,
forms, nor dispatch know which worker library is selected.
The built-in task is process_import_export, queue chassis-import-export.
Arguments are kind and a history UUID string. Import and export share one
handler and one description in django_chassis.worker_tasks.TASKS.
Dramatiq
Added in 1.0.19pip install 'django-chassis[dramatiq]'
Configure the project broker first, for example through django-dramatiq or
dramatiq-postgres[django] and DRAMATIQ_BROKER. Then register Chassis tasks
in both web and worker processes after Django/broker setup:
from django_chassis.services import WorkerService
WorkerService.register_tasks()
Chassis reuses the project broker. Include chassis-import-export if workers
are restricted to named queues, and configure Django connection cleanup in
the integration. Web and workers share the database and media storage.
Celery
pip install 'django-chassis[celery]'
Configure Celery normally; task-module discovery registers the same task
registry. The task name process_import_export and the import
from django_chassis.tasks import process_import_export remain supported.
process_import_export.delay(kind=..., history_id=...) now routes through the
common worker service and returns None. It also works with other providers.
Optional discovery works without Celery installed.
Processing rules
Both external adapters translate the same task metadata: three retries, 1–30 second
backoff, five-minute time limit, and one-day max age. Domain failures recorded
as FAILED are terminal; exceptions escaping processing use worker retries.
History row locks remain held through processing; completed histories are
skipped on redelivery. Database transactions do not roll back external storage
writes, so domain logic and storage must tolerate at-least-once execution.
Inline and Python queue
Inline keeps the request open until completion. ImportExportPythonQueueService
is process-local, suitable for development or a single-process deploy. Use the
external worker backend for multiple web workers.