Repository navigation
fix: honor the container directive — run tasks in Docker (#30) - #36
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #30. nf-spawn ran the task script on the bare instance OS, ignoring a process's
containerdirective. 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 withcommand not found, blocking nf-spawn as an executor for any nf-core pipeline (e.g. taxprofiler).Fix
When
task.containeris set,buildStagingScriptruns.command.shinside that image:.command.sh's relative paths and the S3-staged inputs/outputs line up.docker runpropagates the task's exit code →.exitcode(and thus completion detection from checkIfRunning() treats EC2 propagation-window NotFound as task failure — race condition on first poll #34) stays accurate.submit()threadstask.containerthrough; newbuildRunLine()helper is unit-tested for both paths (bare bash for null/empty/whitespace;docker runwith the image single-quoted) plus an end-to-end staging-script test.Tests
25 tests pass (
./gradlew test, JDK 17), including the new#30container 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/KRAKEN2container processes should now run instead of failingcommand not found. Recommend that run before closing.Fixes #30.