Repository navigation
feat(task): run the command inside spec.container (spawn#386 increment 3) - #408
Merged
Merged
Conversation
…t 3) A TaskSpec with a container image now runs the command inside it instead of being rejected. The generated wrapper (pkg/taskproto/wrapper.go) branches on spec.Container: install Docker on demand (stock AL2023 AMI has none), pull the image, and 'docker run' the argv with the input/output manifest dirs bind-mounted (identity mounts, so in-container paths match the spec). Stage-in/out stay on the host, so the image needs no aws CLI. Private-ECR images (ecrImageAccount != '') get a docker login to their registry host and a scoped ecr:ReadOnly grant on the task instance profile (taskExtraPolicies); public images pull anonymously. resources.gpus>0 passes --gpus all (mirrors cmd/app.go's container path). GenerateWrapper gained a region param for the ECR login. Unit-tested: public vs private-ECR vs host wrappers, GPU flag, mount-dir dedup, ecr grant selection, container dry-run preview. Generated wrapper passes shellcheck. Real-AWS end-to-end smoke is a gated follow-up (needs a TTL + approval per cost-safety). Refs #386
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Real-AWS smoke test of the container path found it hung at 'installing docker...': the command script runs as the unprivileged instance user (bootstrap runs it via 'su - <user>'), but dnf install / systemctl / the docker socket all need root. The install failed silently as non-root, then docker calls hung. Sudo every privileged step in the container branch (AL2023's default user has passwordless sudo), and add a bounded 'sudo docker info' wait loop so we never issue a pull/run against a daemon that isn't up yet. The host path is unchanged (no root needed). Re-verified end-to-end on real AWS: busybox container task installed docker, pulled, ran in-container, staged /work/out.txt to S3, wrote completion.json (exit 0), and self-terminated ~4min in; leak-check clean. Refs #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
spawn#386 increment 3 — container execution for
spawn task run. A TaskSpec with acontainerimage now runs the command inside that image instead of erroring (increment 2 deferred this). This is what makestask runuseful to the container-first workflow adapters #386 exists to serve (biocontainers, nf-core).How it works
GenerateWrapper(pkg/taskproto/wrapper.go) branches onspec.Container:( argv ); rc=$?docker pull→docker run --rm [--gpus all] -v <dir>:<dir> ... <image> <argv>; rc=$?Design points:
ecrImageAccount != "") →docker loginto the registry host + a scopedecr:ReadOnlygrant on the task's instance profile (taskExtraPolicies). Public images pull anonymously, no grant.resources.gpus > 0→--gpus all(mirrorscmd/app.go's container path)..exitcode, SPAWN_COMPLETE, self-terminate — all unchanged. The container only replaces the "run" step.GenerateWrappergained aregionparam (for the ECR login region).The flagship
examples/task-spec.json(a biocontainers image) now runs end-to-end.Testing
( argv )and NO docker/ecr); GPU flag;containerMountDirsdedup/sort;taskExtraPolicies(ecr grant only for private ECR); container dry-run preview. The generated container wrapper passes shellcheck (only pre-existing SC2034 info warnings).TestFlagConventions/TestTier0pass; docs-gen regenerated; Semgrep clean on changed files. Only the pre-existingTestCatalogValidfails incmd(unrelated).Refs #386 (increment 3; adapter migration + stubbed retry classes remain)