Skip to content

feat: PANDA_WORKER_IMAGE env var to override the queue-default worker image - #63

Merged
veprbl merged 4 commits into
mainfrom
feat/worker-image-override
Nov 23, 2026
Merged

veprbl merged 4 commits into
mainfrom
feat/worker-image-override

Conversation

@veprbl

@veprbl veprbl commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The queue-level worker image currently comes from config/harvester/panda_queues.template.json (containerImage: alpine:latest), with no way to change it without editing the template. Consumers that bring their own worker image — e.g. the snakemake-executor-plugin-panda CI, which builds a snakemake worker image — would have to fork or patch the template.

This adds a PANDA_WORKER_IMAGE environment variable (same pattern as PANDA_QUEUES): render-panda-queues.py applies it to the template queue's containerImage before rendering the concrete queues. Unset keeps the committed default. A template lacking a submitter block fails the render loudly instead of silently producing a useless one.

It also adds test coverage for the queue-template containerImage path, which was never exercised before: the smoke test only ever submitted jobs with --container (per-job image), so a broken template → render → submitter chain kept CI green.

Changes

  • scripts/render-panda-queues.py — apply PANDA_WORKER_IMAGE to the template queue before rendering concrete queues (concrete queues inherit the submitter block via templateQueueName, so patching the template is enough); sys.exit if the template has no submitter block
  • docker-compose.yml — pass PANDA_WORKER_IMAGE to the harvester service
  • .env.example, README.md — document the knob
  • tests/test_render_panda_queues.py — unit tests for the render script (template invariant, concrete-queue creation, default preserved without override, override applied, missing-submitter failure); stdlib-only, run in a new unit-tests CI job
  • ci.yml smoke test —
    • assert the rendered panda_queues.cfg inside the live harvester equals the override (python:3.13-alpine) right after the health wait, catching a broken compose → env → render chain in seconds (plus DockerSubmitter template block and templateQueueName inheritance)
    • a second E2E job submitted without --container, asserting via the docker_submitter log (grep -q, no pipe — a pipeline's status is tail's and can't fail) that the queue default was actually used. The stack runs with PANDA_WORKER_IMAGE=python:3.13-alpine (via the composite action's env-overrides), deliberately distinct from the per-job python:3.12-alpine used by the first integration test, so each test proves its own path.
    • assert both jobs' output LFNs (user.alice.ci.out.txt, user.alice.ci.default-image.out.txt) are registered in Rucio, so the second job's stage-out is verified too, not just that some file DID exists

Testing

  • python3 -m unittest discover -s tests — 5 tests pass locally (including the missing-submitter failure mode)
  • This PR's CI is green: unit-tests and smoke-test both pass, with all new assertions firing in the logs (rendered-config exact-value check, queue-default grep -q assertion, both-LFN Rucio check)
  • Consumer validation: eic/snakemake-executor-plugin-panda CI uses this knob (PANDA_WORKER_IMAGE=panda-compose/snakemake-worker:$SNAKEMAKE_VERSION in its .env) and its snakemake → PanDA → docker worker → Rucio E2E is green with it

Hermes Agent and others added 4 commits November 20, 2026 15:09
… image

Concrete queues inherit the submitter block from the shared template
queue via templateQueueName, so render-panda-queues.py can patch the
template's containerImage at render time. Without PANDA_WORKER_IMAGE the
committed template default (alpine:latest) is kept; consumers with their
own worker image (e.g. a snakemake CI that builds one) no longer need to
edit the template to use it.

Adds test coverage for the queue-template containerImage path, which the
smoke test never exercised: it only ever submitted jobs with --container
(per-job image), so a broken template -> render -> submitter chain kept
CI green.

- scripts/render-panda-queues.py: apply PANDA_WORKER_IMAGE to the
  template queue before rendering concrete queues
- docker-compose.yml: pass PANDA_WORKER_IMAGE to the harvester
- .env.example, README: document the knob
- tests/test_render_panda_queues.py: unit tests for the render script
  (template invariant, concrete-queue creation, default preserved,
  override applied), run in a new unit-tests CI job
- smoke test: assert the rendered panda_queues.cfg in the live harvester
  (after the health wait — the file only appears once the entrypoint
  finishes setup), and run a second E2E job WITHOUT --container,
  asserting via the docker_submitter log that the queue default
  (overridden to python:3.13-alpine via env-overrides, distinct from the
  per-job python:3.12-alpine) was actually used
grep ... | tail -1 always exits 0 (a pipeline's status is the last
command's), so the queue-default check could never fail the step — it
only passed because the image happened to be correct. Drop the pipe for
the assertion: grep -q exits 1 when the line is missing, failing the
step. The informational grep | tail -1 above it is unchanged.
…x stale comment

The rendered-config check only asserted containerImage is non-empty,
so a broken compose -> env -> render chain for PANDA_WORKER_IMAGE would
only surface when the queue-default job lands in the wrong container
~4 minutes later. Assert the exact value CI sets (python:3.13-alpine)
right after the health wait, catching the whole chain in seconds.

Also update the first integration test's comment: the queue default in
CI is no longer alpine:latest but the PANDA_WORKER_IMAGE override; the
reasoning (deliberately distinct images prove each path) is unchanged.
- render-panda-queues.py: a missing submitter block now fails loudly
  (sys.exit) instead of setdefault silently creating a nameless,
  module-less block that no harvester could use
- tests: cover that failure mode; fix the env comment (four vars, not
  three); keep a minimal PATH in the test env in case the script ever
  shells out
- smoke test: assert BOTH jobs' output LFNs are registered in Rucio, not
  just that some file DID exists (the first job's output alone would
  satisfy the old check); pattern matches the search's bare JSON list
  response

Co-authored-by: Hermes Agent <hermes@localhost>
@veprbl
veprbl requested a review from wdconinc November 21, 2026 02:51
@veprbl
veprbl merged commit bf9762a into main Nov 23, 2026
3 checks passed
@veprbl
veprbl deleted the feat/worker-image-override branch November 23, 2026 00:46
veprbl added a commit that referenced this pull request Nov 23, 2026
Review-driven cleanups on top of the rebase:

- drop the queue-template containerImage hunk: PANDA_WORKER_IMAGE
  (merged in #63) is the supported way to point the queue at a custom
  worker image, so the template stays generic (alpine:latest)
- rucio client config fallback: resolve the host path from the
  compose-provided /config/rucio directory bind via mountinfo instead of
  hardcoding a dev checkout path (/home/agent/...); fail the worker
  loudly if neither bind is found, rather than mounting a nonexistent
  file
- remove the /agent/ -> /home/agent/ prefix translation: mountinfo's
  bind root is the actual host path (verified: /agent/... is a real
  directory here; CI runners have no /agent), and the docker daemon
  resolves sources in the host namespace either way
- worker network: queue-config workerNetwork key (default
  panda-compose_default) instead of a hardcoded name, so a custom
  compose project name (-p) still gets hostname resolution

Co-authored-by: Hermes Agent <hermes@localhost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants