Repository navigation
fix: mount attached storage before the user-data/command script (#166) - #167
Merged
Merged
Conversation
The EFS/FSx/--attach-volume mount script was appended to the END of user-data, so it ran AFTER the user's --user-data/--command workload had already completed. A program launched by user-data that needed the volume (e.g. an nf-core pipeline validating its db_path mount exists) saw an unmounted path and failed; the volumes only mounted once the workload had finished — useless. Fix: build the storage-mount script first and inject it BEFORE CustomUserData in the Linux bootstrap (new BootstrapConfig.StorageScript), instead of appending it after. buildUserData now takes the storage script and threads it through BuildLinuxBootstrap. The job-array path no longer re-appends storage (the base user-data already has it, correctly placed) — that also fixes a latent double-mount. This covers both the head node and the per-task path that nf-spawn's ext.volumes zero-copy DB workflow relies on (nf-spawn's task staging script is the CustomUserData, so it now also runs after the mount).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #166. A serious ordering bug that undermines the whole
ext.volumeszero-copy DB workflow (nf-spawn 0.5.0) — on both the head and the tasks.The bug
The storage-mount script (EFS / FSx /
--attach-volume) was appended to the end of user-data:So the user's
--user-data/--commandworkload ran first, to completion, and the volumes mounted after it. The filer's head-node boot log shows a pipeline validating/opt/databases/metaphlan, failing because it's unmounted, thenmkdir+mountrunning. The volumes end up correctly mounted — just minutes too late to be useful.Fix
Build the storage script first and inject it before the user's script, inside the bootstrap:
BootstrapConfig.StorageScript— emitted right beforeCustomUserDatainBuildLinuxBootstrap(underset +e, so a mount hiccup can't skip the user script).buildUserDatatakes the storage script and threads it through; the single-instance path builds it beforebuildUserDatainstead of appending after.Why this also fixes the task side
nf-spawn ships its task staging script as
--user-data-file, i.e. it becomesCustomUserData. So the task's.command.shnow runs after the volume mount too — which is exactly whatext.volumes(symlink stage-name → mount) needs.Tests
TestBuildLinuxBootstrap_StorageMountsBeforeUserScript— asserts the storage marker precedes the user-script marker (the regression guard).TestBuildLinuxBootstrap_NoStorageScriptWhenEmpty— no storage section when unset.buildUserDatacall sites updated;make checkgreen.Note for the demo
This is why the smoke test would have failed even with everything else correct — the head's pipeline validated
db_pathbefore spawn mounted the volume. With this fix the mount is live beforenextflow runstarts. Needs a fresh launch on the new spawn build (the ordering is baked into user-data at launch).