Aller au contenu

Celery task conventions

Status: Placeholder — to be developed. Last reviewed:

Scope

How to add and operate a Celery task: task naming (full dotted path, never bare), idempotency (must be safe to re-run), retry / backoff defaults, when to use @shared_task vs @app.task, when a task vs a service function vs a management command, beat schedule conventions, what make celery-logs / make beat-logs show, how a task surfaces failure (Sentry, Django log, no silent swallow).

Sources to mine when writing this

  • Celery configuration (config/celery.py or equivalent).
  • Beat schedule (celerybeat-schedule is the runtime artefact; the source schedule is in code — find it).
  • Existing tasks: apps/sync/ (Doctolib daily 3 AM), apps/imports/, apps/dataquality/, apps/pennylane_sync/.
  • Makefile celery targets — document what each does.
  • Any past incident where a task ran twice or failed silently — recipe for the rule that prevents recurrence.