Repository navigation
feat: dispatch each task via spawn task run (spawn#386 adapter migration) - #73
Merged
Merged
Conversation
…ion) Ports nf-spawn to the shared workflow-adapter protocol. submit() builds a spawn TaskSpec and runs `spawn task run` (detached) instead of calling `spawn launch`; checkIfRunning() polls `spawn task status --check-complete`; killTask() terminates by task id. spawn owns launch, sizing, the durable completion record, self-termination, and a scoped instance profile. Design (option b): nf-spawn KEEPS its own staging script — input localization (#37), zero-copy symlink short-circuits (#55/#49), and its own `docker run` are behaviors spawn's wrapper doesn't replicate, so faithfully porting them into spawn's manifest model would regress nf-core pipelines. The staging script becomes the TaskSpec `command` (bash -lc), running identical bash on the instance. No inputs/outputs manifests; the work bucket is declared in resources.s3_read_write so the scoped profile grants the S3 access the script's aws s3 sync/cp need. - ext.instanceType → resources.instance_type (EXACT pin, spawn#413 — a family hint would size t3.medium→t3.nano). ext.ami/az/volumes/fsx/efs → placement. - Staging script gains signalCompletion flag: under task-run it exits with the task's real code and does NOT touch /tmp/SPAWN_COMPLETE (which would race the wrapper's own completion signal, terminating the box before completion.json uploads). Legacy path unchanged. - Requires spawn >= 0.85.0 (instance_type pin). Compile + Spock + assemble green. Real-AWS smoke (a Nextflow pipeline) pending, gated. Refs spore-host/spawn#386
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
Ports nf-spawn — the last and hardest adapter — to the spawn task-execution protocol (spawn#386).
submit()stops callingspawn launchand instead builds a TaskSpec and shells out tospawn task run(detached). spawn now owns launch, sizing, the durable completion record, self-termination, and a scoped least-privilege instance profile.Design decision: keep nf-spawn's staging script (option b)
Unlike the other four adapters, nf-spawn's staging has behaviors spawn's wrapper doesn't replicate: input localization by source URI (#37), directory detection, the zero-copy symlink short-circuits (#55/#49) that let a
path-input reference DB resolve to anext.volumes/FSx mount, thes3:///repair (#41), and its owndocker runwith resolvedrunOptions/bind-mounts. Faithfully porting those into spawn's manifest model would regress nf-core pipelines. So nf-spawn keeps its staging script, which becomes the TaskSpeccommand(bash -lc) — identical bash on the instance. There are noinputs/outputsmanifests; instead the work bucket is declared inresources.s3_read_writeso the scoped profile grants exactly the S3 access the script'saws s3 sync/cpneed.Mapping
ext.instanceType→resources.instance_type— an exact pin (spawn#413). Critical: nf-spawn's type is exact (defaultt3.medium) with no cpu/mem, so a family-only hint would size to the cheapest in-family (t3.nano) — a severe silent downsizing.ext.ami/ext.az/ext.volumes/ext.fsx/ext.efs→ theplacementblock (spawn ≥ 0.84.0).ext.spot→resources.purchase=spot+fallback=on_demand.checkIfCompleted()still reads the durable.exitcodefrom the S3 work dir (the authoritative signal carrying the real task exit code, checkIfRunning() treats EC2 propagation-window NotFound as task failure — race condition on first poll #34);checkIfRunning()pollsspawn task status --check-complete;killTask()→spawn terminate <task-id>.The completion-signal race (subtle, fixed)
spawn's wrapper writes
/tmp/SPAWN_COMPLETEafter stage-out + completion.json. nf-spawn's staging script also touched it (itsspored completefallback) mid-command — which would let spored terminate the box before the completion record uploads. Fixed with asignalCompletionflag: under task-run the script insteadexits with the task's real code (which the wrapper records) and never touchesSPAWN_COMPLETE. The legacy path is unchanged.Testing
buildTaskSpecexact-pin + placement mapping,buildTaskRunCommanddetached,s3BucketUri, thesignalCompletionbehavior).compileGroovy+test+assembleall green (JDK17, Nextflow 26.04.3).instance_typepin lands in the next spawn release).Refs spore-host/spawn#386