Skip to content

fix: honor the container directive — run tasks in Docker (#30) - #36

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/30-container-directive
Jun 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/30-container-directive

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

Summary

Fixes #30. nf-spawn ran the task script on the bare instance OS, ignoring a process's container directive. nf-core modules (and most real pipelines) rely on it — fastqc, fastp, kraken2, fasterq-dump, etc. live in the image, not on the OS — so every such process failed with command not found, blocking nf-spawn as an executor for any nf-core pipeline (e.g. taxprofiler).

Fix

When task.container is set, buildStagingScript runs .command.sh inside that image:

docker run --rm -v ${LOCAL_DIR}:${LOCAL_DIR} -w ${LOCAL_DIR} <image> bash .command.sh 1>.command.out 2>.command.err

submit() threads task.container through; new buildRunLine() helper is unit-tested for both paths (bare bash for null/empty/whitespace; docker run with the image single-quoted) plus an end-to-end staging-script test.

Tests

25 tests pass (./gradlew test, JDK 17), including the new #30 container cases.

Validation note

Unit-tested. The true end-to-end proof is an nf-core pipeline run (e.g. taxprofiler) on a build with this fix — the FASTQC/FASTP/KRAKEN2 container processes should now run instead of failing command not found. Recommend that run before closing.

Fixes #30.

nf-spawn ran the task script on the bare instance OS, ignoring a process's
`container` directive. nf-core modules (and most real pipelines) rely on it —
every tool (fastqc, fastp, kraken2, fasterq-dump, …) lives in the image, not on
the OS — so every such process failed with "command not found", blocking
nf-spawn as an executor for any nf-core pipeline.

Fix: when task.container is set, buildStagingScript runs .command.sh inside that
image via `docker run --rm -v ${LOCAL_DIR}:${LOCAL_DIR} -w ${LOCAL_DIR} <image>
bash .command.sh` instead of bare `bash`. The work dir is bind-mounted at the
same path and set as cwd so relative paths + the S3-staged inputs/outputs line
up, and docker run propagates the task exit code so .exitcode stays accurate.
No container → unchanged bare-OS execution. Docker is preinstalled on the AMI.

submit() passes task.container through; new buildRunLine() helper is unit-tested
for both paths (bare bash for null/empty/whitespace; docker run with the image
single-quoted), plus an end-to-end staging-script test.

Fixes #30.
@scttfrdmn
scttfrdmn merged commit 03f6783 into main Jun 9, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the fix/30-container-directive branch June 9, 2026 04:17
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.

container directive ignored — task script runs on OS, not inside Docker/Singularity

1 participant