django-tasks-db-async
Async worker for django-tasks-db with OpenTelemetry instrumentation.
Table of Contents
Installation
pip install django-tasks-db-async
Configuration
Add both django_tasks_db and django_tasks_db_async to INSTALLED_APPS, then configure the TASKS setting to use django_tasks_db.DatabaseBackend:
INSTALLED_APPS = [
...
"django_tasks_db",
"django_tasks_db_async",
]
TASKS = {
"default": {
"BACKEND": "django_tasks_db.DatabaseBackend",
"QUEUES": ["default"],
},
}
Run the database migrations to create the task result table:
python manage.py migrate
Running the worker
Start the worker with the db_async_worker management command:
python manage.py db_async_worker
Options
| Option | Default | Description |
|---|---|---|
--queue-name |
default |
Queue(s) to process. Separate multiple with a comma. Use * to process all queues. |
--interval |
1 |
Seconds to wait when the queue is empty before polling again. |
--concurrency |
10 |
Number of concurrent worker coroutines. |
--batch |
False |
Process all outstanding tasks and exit. |
--max-tasks |
unlimited | Maximum number of tasks each worker will execute before stopping. |
--backend |
default |
Backend alias to operate on (as configured in TASKS). |
--worker-id |
auto | Worker identifier, must be unique across the pool. |
Examples
Process tasks from all queues with 4 concurrent workers:
python manage.py db_async_worker --queue-name='*' --concurrency=4
Process tasks from specific queues:
python manage.py db_async_worker --queue-name=default,emails,notifications
Run in batch mode — process outstanding tasks and exit (useful for cron jobs):
python manage.py db_async_worker --batch
Signals
The worker dispatches the standard task_started and task_finished Django signals around each task execution, compatible with both django.tasks (Django 6.0+) and the standalone django-tasks package.
OpenTelemetry
The worker records a span for each task execution using the OpenTelemetry messaging semantic conventions. No additional configuration is required — the worker picks up whatever TracerProvider is active in the process.
Each span includes the following attributes:
| Attribute | Value |
|---|---|
messaging.system |
django_tasks_db |
messaging.operation.type |
process |
messaging.destination.name |
queue name |
messaging.message.id |
task result UUID |
messaging.client.id |
worker ID |
messaging.operation.name |
fully qualified task function name |
Failed tasks set the span status to ERROR and record the exception as a span event.
License
django-tasks-db-async is distributed under the terms of the MIT license.
Metadata
Release files for django-tasks-db-async 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_tasks_db_async-0.0.2.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tasks_db_async-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / django_tasks_db_async-0.0.2.tar.gz
| Download URL | django_tasks_db_async-0.0.2.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb69621f2571dd9f3a5e550c8a29aa8d3b0c40d1516a0d6402a578609a08f5fa
|
|
BLAKE2b-256 checksum How to use checksums |
ab2d56d8e9b20305e1d888e091ca805ade6ad64432799b17777c51e35a806324
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / django_tasks_db_async-0.0.2-py3-none-any.whl
| Download URL | django_tasks_db_async-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60fbde1b4d506132a04079f3a3df6793dd8ad392ecf63c8897b03857ea0bf819
|
|
BLAKE2b-256 checksum How to use checksums |
9b331c8430952f0cce97ba93c0e01ebfabda5bb5899c4ea11b3a85783ab682af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency log