This project is archived. Its data is read-only.
webapp_django worker capability: wire the Celery app (celery.py + async extra)
Part of marinerg-i epic &8. Make the marinerg app image **worker-capable** so infra#18 can deploy a Celery worker and facility-service#5 can offload work. The backend wires `dispatch()` (sync) today but had **no Celery app** — no `celery -A <app>` target, and celery isn't in the image. The `CELERY_*` / `DJANGO_TASK_BACKEND` settings are inherited from `ichec_django_core.settings`, and the pinned `ichec-django-core` (1.4.0) already ships the tasks module (`create_celery_app`), so no django-core release is needed. ### Part A — app package (this repo) — MR !39 - **`src/marinerg_backend/celery.py`** — `app = create_celery_app(name="marinerg_backend")`. Returns `None` in sync mode (celery-optional). - **`src/marinerg_backend/__init__.py`** — expose `celery_app` so `celery -A marinerg_backend` resolves the instance. The worker runs under `deploy.settings` in the image (already the image's `DJANGO_SETTINGS_MODULE`, which re-exports this project's posture); the app name is the worker target. - **`pyproject.toml`** — `worker` extra = `ichec-django-core[async]` (celery + redis). - Smoke tests: sync → `celery_app is None`, celery never imported; async (`[worker]`) → configured `Celery`, `main == "marinerg_backend"`. Verified both modes. **Non-negotiable (held):** sync stays the seamless default — no async extra / `DJANGO_TASK_BACKEND` unset ⇒ nothing changes, celery never imported. ### Part B — ship celery in the deploy image (`marinerg-i/marinerg-deploy`) **Correction (2026-07-19):** `ichec_manifest.yaml` is **dead** — the image is no longer built by the `ichec_cicd` wrapper. It is built by **`marinerg-i/marinerg-deploy`** (`Dockerfile` + `pins.yaml`), which replaced the wrapper. So making the image worker-capable is: 1. Merge Part A → CI publishes `marinerg_backend` (next tag, ~1.3.0) to public PyPI **with** the `worker` extra + `celery.py`. 2. In `marinerg-deploy`: bump `pins.yaml` backend pin to the new version and change the `Dockerfile` install to `marinerg_backend[worker]==<new>`. This bakes celery into the image while sync stays default (the worker only activates once infra flips `DJANGO_TASK_BACKEND`). A `marinerg_backend` release **is** required for Part B (the image installs the package from PyPI) — this is the only cascade; django-core does not move. Converge/verify is infra#18's job. Sizing: w3 — celery.py + __init__ wiring + pyproject extra + smoke tests (Part A), plus the deploy-image pin/Dockerfile bump (Part B); verified on both backends.
issue