Repository navigation
feat: stage task results back to S3 work dir so tasks complete (#14) - #16
Merged
Merged
Conversation
Tasks dispatched to spawn instances ran but never returned results to
Nextflow, so outputs never bound and downstream tasks hung in PENDING
forever. nf-spawn had no copy-back logic at all.
buildStagingScript() now emits user-data that:
1. aws s3 sync's the S3 work dir (task.workDirStr) down to a local dir,
2. runs the task script, capturing .command.out/.command.err and the
REAL exit code into .exitcode,
3. syncs outputs back up, then uploads .exitcode LAST so Nextflow never
sees a completed exitcode before the outputs land.
Nextflow reads .exitcode + declared outputs from the work dir to finalize
the task, so this is what lets a pipeline progress past the first process.
Chose S3 sync over scp-before-terminate: the latter is lossy under
--on-complete terminate, while S3 sync is idempotent and object-atomic.
Did NOT adopt BashWrapperBuilder (as floated on the issue): with an S3
work dir its default SimpleFileCopyStrategy (nf-amazon's S3 strategy is
not on a generic executor's classpath) bakes unusable s3:// paths into
.command.run's stage/unstage and exit-file writes. The self-contained
sync wrapper sidesteps that and is directly testable.
buildStagingScript/shellQuote are package-scope and pure; Spock specs
assert stage-down→run→stage-up ordering, real-exitcode capture, and
.exitcode-uploaded-last.
Fixes #14
Merged
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.
Problem
Tasks dispatched to spawn instances ran but never returned results to Nextflow. nf-spawn had no copy-back logic — and declared outputs never appeared in
task.workDir, so outputs never bound and downstream tasks hung inPENDINGforever (the symptom in #12).Fix
buildStagingScript()now emits instance user-data that:aws s3 syncs the S3 work dir (task.workDirStr) down to a local dir,.command.out/.command.errand the real exit code into.exitcode,.exitcodelast so Nextflow never observes a completed exitcode before the outputs land.Nextflow reads
.exitcode+ declared outputs from the work dir to finalize the task, so this is what lets a pipeline progress past its first process.Design notes
--on-complete terminate(partial copy → lost results, no recovery); S3 sync is idempotent and object-atomic. (Matches the decision on No output staging back to task.workDir → tasks never bind outputs, downstream stays PENDING #14.)BashWrapperBuilder(as floated on the issue). I verified against the 26.04.3 jar: with an S3 work dir, its defaultSimpleFileCopyStrategy(nf-amazon's S3 strategy isn't on a generic executor's classpath) bakes unusables3://paths into.command.run's stage/unstage and the exit-fileprintf. The self-contained sync wrapper sidesteps that and is directly unit-testable. Left a note on No output staging back to task.workDir → tasks never bind outputs, downstream stays PENDING #14 with the detail.Test
buildStagingScript/shellQuoteare package-scope and pure. Spock specs assert stage-down → run → stage-up ordering, real-exitcode capture,.exitcode-uploaded-last, and shell quoting/escaping../gradlew testgreen (5 tests).Sequencing
Builds on #13 (merged) — that made the script actually run; this makes the task complete. Depends on the instance role having S3 read/write on the work-dir bucket (already true for the demo).
Fixes #14