Celery & Async Tasks
Overview
Celery runs alongside Django using Redis as both the message broker and result backend. django-celery-beat stores periodic task schedules in the database so they can be managed via the Django admin.
Services
| Service | Role |
|---|---|
celery_worker | Executes tasks |
celery_beat | Enqueues periodic tasks on schedule |
redis | Broker + result backend |
Common Task Types
- Email dispatch: welcome emails, password resets, assignment notifications (SendGrid via django-anymail)
- PDF generation: WeasyPrint renders filled form data into PDFs, then uploads to S3
- Digital signing: pyHanko applies signatures to completed PDFs
- Background check polling: periodic checks against Clearchecks API to update application status
- Scheduled reminders: competency test expiry warnings, document deadline alerts
Running Workers Locally
Docker Compose starts workers automatically. To run manually:
bash
# Worker
docker compose run --rm celery_worker celery -A config worker -l info
# Beat scheduler
docker compose run --rm celery_beat celery -A config beat -l info --scheduler django_celery_beat.schedulers:DatabaseSchedulerMonitoring
Check task history and scheduled tasks via Django admin at /admin/django_celery_beat/ and /admin/django_celery_results/.