Skip to content

A container task cannot see its mounted EFS: containerMountDirs derives -v only from manifests, so placement.efs_id is host-tasks-only #570

Closed

Description

@scttfrdmn

Found from the cookbook side (scientific-codes-cookbook) while looking at whether large inputs could be staged to a shared filesystem once instead of copied per task. placement.efs_id is honored on the task path — I want to be clear about that up front, because the obvious guess is that it's the #556 class of dropped field and it isn't. taskStorageScript reads it and emits a real mount script (cmd/task.go:731–740), threaded in via launcher.Options.StorageScript. The filesystem genuinely gets mounted at /efs on the instance.

The container never sees it.

Versions: spawn 0.103.1, commit ec968ec.

1. /efs is not bind-mounted into the container, and cannot be

writeContainerRun builds the entire -v list from one source:

var mounts strings.Builder
for _, d := range containerMountDirs(spec) {
	fmt.Fprintf(&mounts, "-v %s:%s ", shQuote(d), shQuote(d))
}
p("  sudo docker run --rm --user \"$(id -u):$(id -g)\" %s%s%s %s\n", ...)

— pkg/taskproto/wrapper.go:305–310

and containerMountDirs is manifest-derived only:

for _, m := range spec.Inputs  { add(m.Destination) }
for _, m := range spec.Outputs { add(m.Source) }

— pkg/taskproto/wrapper.go:339–342

Placement is not consulted. So for spec.Container != "", no placement storage — EFS, FSx for Lustre, or placement.volumes from snapshots — is visible inside the container, even though all three are mounted on the host and AttachVolumes carries an explicit MountPoint the caller chose. The host path (spec.Container == "", wrapper.go:154) runs argv directly and sees everything.

That asymmetry is the bug, and it is load-bearing rather than cosmetic: placement.volumes exists specifically for shared reference data ("mounted read-only (the common shared-reference-data case)", taskspec.go:78), and a reference-data volume you can't read from the container is not usable by any containerized task. Which is all of them, in the aarch.bio/aarch.science model — one tool per image, so every recipe is a container task.

Suggested fix: have containerMountDirs also add spec.Placement's mount points — each Volumes[].MountPath, plus the EFS and FSx mount points. Those are currently hardcoded in taskStorageScript ("/efs" at cmd/task.go:738, "/fsx" at :748) while userdata.StorageConfig.EFSMountPoint and aws.LaunchConfig.EFSMountPoint are both already parameterized, so the constants would want to become shared or spec-supplied first — see (3).

One wrinkle worth deciding deliberately rather than inheriting: the stage-in mkdir -p loop reuses containerMountDirs' output on purpose, so the two lists can't drift (wrapper.go:104–113, #564). A mount point must not be mkdir -p'd by stage-in — that would race the boot-time mount and could leave the container bind-mounted onto an empty pre-mount directory. So this is the one place where the two lists legitimately need to differ, and the comment's invariant needs restating rather than quietly breaking.

2. A manifest source/destination that isn't s3:// parses, validates, dry-runs — then fails after a paid boot

Validate requires only non-empty:

for i, m := range s.Inputs {
	if m.Source == "" || m.Destination == "" {
		add("inputs[%d]: source and destination are both required", i)
	}
}

— pkg/taskproto/taskspec.go:203–207

and the wrapper emits aws s3 cp unconditionally, both directions (wrapper.go:117, wrapper.go:173). So the natural way to express "read this from the shared filesystem" —

{"inputs": [{"source": "/efs/refs/GRCh38.fa", "destination": "/tmp/GRCh38.fa"}]}

— passes validation, passes --dry-run, launches, boots, installs Docker, and then dies in stage-in with:

aws: [ERROR]: An error occurred (ParamValidation): usage: aws s3 cp <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>

(measured, on the same aws-cli). Same for an output written to /efs/.... #558 added DisallowUnknownFields, so this isn't an unknown key being dropped — it's a known field holding a value nothing downstream can execute.

Notably the IAM path already anticipates this case and tolerates it:

// s3Buckets extracts the distinct S3 bucket names from a manifest list's s3://
// endpoints (source or destination, whichever is the s3 side). Non-s3 entries
// (local paths) are skipped.

— cmd/task.go:757

so one half of the code treats a local manifest path as a supported shape and the other half can't run it.

Suggested fix, in preference order. Either is a real improvement; the first is much cheaper:

  • Reject it in Validate — require s3:// on the S3 side of each manifest entry, the way resources.s3_read_write already does (taskspec.go:213–217). Turns a paid boot into a parse error, and is honest about the model being S3-only.
  • Or support it in the wrapper — dispatch on the scheme, aws s3 cp for s3:// and cp/ln -s for a local path. That is the version that makes the cost case below reachable through the manifest rather than around it.

The reason I'd push past the cheap fix eventually: routing around this means putting the copy in spec.command, which loses stage-in's sudo chown "$(id -u):$(id -g)" (#565) and the pre-mount mkdir -p (#564) for that path. Both of those exist because getting them wrong cost real debugging, so "just do it in the command" quietly re-opens two closed traps.

3. /efs and /fsx are hardcoded on the task path

taskStorageScript sets sc.EFSMountPoint = "/efs" (cmd/task.go:738) and sc.FSxMountPoint = "/fsx" (:748), with no TaskSpec field to override — while Placement.Volumes[].MountPath is spec-supplied, and both userdata.StorageConfig.EFSMountPoint and aws.LaunchConfig.EFSMountPoint (pkg/aws/client.go:236) are parameterized. A mount_point alongside efs_id / fsx_lustre_id would make the three placement storage kinds consistent, and (1) needs a non-hardcoded value to mount anyway.

Why this matters for cost, which is what sent me looking

The cookbook's recipe shape is a sequence of single-tool container tasks with S3 between them — deliberate, because aarch.* ships one tool per image, so a pipe isn't expressible and intermediates round-trip through S3. That makes per-task staging a fixed cost paid once per task and rising with task count.

Measured on cookbook-relion-postprocess-r1 (m8g.large): 94s command window, of which relion_postprocess was 25s. The other ~69s is stage-in of 975 MiB, the Docker install, and the image pull. The science was a quarter of its own task, and roughly a third of the instance's whole three-minute life.

A shared filesystem is the obvious place for that to go away — reference data mounted rather than copied, and intermediates handed between tasks without a round trip. placement.efs_id looks like exactly the mechanism, and the mount works. It just can't be reached from inside a container, and the manifest can't name a path on it. Fixing (1) and (2) is what makes it usable; today the feature is effectively host-tasks-only, which isn't stated anywhere.

Not asking for a staging redesign here — three narrow fixes, of which (1) is the blocking one.

Activity

  1. added
    bug
    on Sep 4, 2026
  2. scttfrdmn commented on Sep 5, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed by #575, shipped in v0.104.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions