Skip to content

feat: forward ext.fsx/ext.efs to spawn launch for shared reference filesystems (#67) - #68

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/67-shared-fsx-efs
Jun 16, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/67-shared-fsx-efs

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

Closes #67.

A shared filesystem is the right primitive for one stable reference DB read by a wide fan-out (taxprofiler's Kraken2/MetaPhlAn DBs over 30–100 samples): one copy, N concurrent read-only mounts, no per-snapshot Fast-Snapshot-Restore credit cliff that ext.volumes hits at scale (the failure that motivated the issue — ~50 volumes from 2 DB snapshots drained FSR credits and most fell back to ~6–8 MB/s S3 lazy-load).

Change

New ext.fsx / ext.efs directives, mirroring the ext.az (#62) / ext.volumes (#45) forwarding already in place:

process {
  withName: 'KRAKEN2_KRAKEN2' {
    ext.fsx = 'fs-0abc'                                       // → --fsx-id fs-0abc --fsx-mount-point /fsx
    // or, to declare which DB dirs symlink zero-copy:
    ext.fsx = [ id: 'fs-0abc', mount: '/fsx', paths: ['kraken2'] ]
    // ext.efs = 'fs-0def'                                    // → --efs-id fs-0def --efs-mount-point /efs
  }
}

Both halves of comment-1's requirement:

  1. Launch side — ext.fsx/ext.efs → spawn launch --fsx-id/--efs-id (+ --*-mount-point), passed only when set (default unchanged).
  2. Staging side — the mount is bind-mounted read-only into the task container, and each declared paths entry becomes <mount>/<name> (e.g. /fsx/kraken2) fed into the 0.5.0 stage-name symlink works for --db <name> (Kraken2) but not find -L <name> (MetaPhlAn) — symlink missing in task work dir #55 mountPaths, so a path input whose stage name matches symlinks zero-copy instead of aws s3 cp-ing the DB per task — even when the pipeline stages db_path into the S3 work area. Without this, tasks would mount the FS but still localize from S3.

Scope decision: id form only

nf-spawn launches one instance per task, so a per-task --fsx-create would create one filesystem per task across a fan-out — the exact multiplication a shared FS is meant to avoid. parseSharedFs rejects a create: map with a pointer to pre-creating by id (spawn fsx create). Ephemeral per-run shared FS is left as a follow-up.

Tests

8 new specs: --fsx-id/--efs-id forwarding (and absence when unset), parseSharedFs (bare-id string, map, paths normalization, key aliases, null), create-form rejection, missing-id rejection, sharedFsBindMounts (read-only, multi), sharedFsMountPaths (<mount>/<name>, bare-mount fallback, trailing-slash), and the end-to-end #55 zero-copy symlink for a shared-FS DB whose Nextflow source is s3://. Full Spock suite green; compileGroovy clean (JDK 17 / Gradle 8.14).

Docs

CHANGELOG.md Added entry; README directive table gains ext.fsx/ext.efs rows, and the "Delivering reference data" section gains option 2 (shared FS for wide fan-out) with the FSR-credit rationale.

Requires spawn ≥ 0.46.0 (FSx/EFS mount-by-id).

Consumer (aws-microbiome-demo) is already wired (FSX_ID/FSX_MOUNT, ext.fsx emitted per classifier) — this flips it on.

…lesystems (#67)

A shared filesystem is the right primitive for one stable reference DB read
by a WIDE fan-out (taxprofiler's Kraken2/MetaPhlAn DBs over 30-100 samples):
one copy, N concurrent read-only mounts, no per-volume Fast-Snapshot-Restore
credit cliff that ext.volumes hits at scale.

- ext.fsx / ext.efs accept a bare 'fs-xxx' id (mount defaults /fsx, /efs) or a
  map [id:, mount:, paths:]. Forwarded to spawn launch --fsx-id/--efs-id (+
  --*-mount-point) only when set, so the default is unchanged.
- The mount is bind-mounted read-only into the task container, and declared
  'paths' (e.g. ['kraken2'] -> /fsx/kraken2) feed the #55 mountPaths so a
  staged path-input DB symlinks zero-copy instead of localizing from S3 — the
  second half of comment-1's requirement (forwarding the flag alone is not
  sufficient).
- Only the existing-filesystem (id) form is supported. nf-spawn launches one
  instance per task, so --fsx-create would create one filesystem per task
  across a fan-out; parseSharedFs rejects a create: map with a pointer to
  pre-creating by id. Ephemeral per-run shared FS is left as a follow-up.

Requires spawn >= 0.46.0 (FSx/EFS mount-by-id).

Closes #67
@scttfrdmn
scttfrdmn merged commit 7fb4f98 into main Jun 16, 2026
4 checks passed
@scttfrdmn
scttfrdmn deleted the feat/67-shared-fsx-efs branch June 16, 2026 23:47
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.

Forward ext.fsx (and ext.efs) to spawn launch for shared reference filesystems

1 participant