Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Rank 0 ran mpirun as the bare last line of the MPI user-data. Its output reached only cloud-init-output.log, and nothing wrote /tmp/SPAWN_EXITCODE or /tmp/SPAWN_COMPLETE, so spored's --on-complete never fired on any member and the cohort rode the job out to idle or TTL. The fix gives --mpi-command the --command contract on rank 0. Under set +e, mpirun's output is teed to /var/log/spawn-command.log, and PIPESTATUS[0] is recorded to /tmp/SPAWN_EXITCODE. Rank 0 then writes the same SPAWN_COMPLETE record on every peer over the root SSH mesh mpirun already depends on, in parallel, before writing its own. Each member's spored then runs its own --on-complete. When rank 0 gives up waiting for peer SSH, it goes through the same path, so the reachable members stop too. The tests execute rank 0's block of the rendered script under set -e with stand-in mpirun/ssh/hostname. They fail against the original template and against each of three partial reverts: no peer signal, $? for PIPESTATUS, and no tee.
The fake IMDS server writes its identity document through a JSON encoder instead of concatenating it into a raw ResponseWriter write, and the MPI harness runs rank 0's block from a script file rather than bash -c.
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.
Root cause
pkg/userdata/mpi.goran mpirun as the bare last line of rank 0's appended MPI script. It did not tee to/var/log/spawn-command.log, did not record an exit code, and did not write/tmp/SPAWN_COMPLETE. spored fires--on-completeonly when that file appears (pkg/agentcheckCompletion), so no member ever acted, rank 0 included. The cohort rode the job out to idle or TTL. The--commandpath got these steps in #566/#614. The MPI path never did. The non-root ranks had no way to learn the job was over, and spored has no peer-completion channel.Fix
On rank 0,
--mpi-commandnow follows the--commandcontract:set +e. The bootstrap this script is appended to runs underset -e, which is the A task whose command fails writes no completion record at all, so the box rides to TTL instead of self-terminating #566 failure class.mpirun ... 2>&1throughtee -a /var/log/spawn-command.log, sospawn array logs <name> --index 0works.PIPESTATUS[0](mpirun's status, not tee's) to/tmp/SPAWN_EXITCODE.spawn_mpi_donewrites the record (same JSON shape as--command,"source": "mpi") on every peer over the root SSH mesh mpirun itself depends on. Rank 0's key is already authorized on each peer, and the readiness loop has just proven each one accepts a BatchMode login, so this adds no new channel or IAM grant. Peers are signalled in parallel, waiting on their own PIDs only (not a barewait, which would also wait on a concurrent--commandsubshell). Rank 0 writes its own record after the peers, so it cannot start terminating while peers are still unsignalled. Rank 0 skips its own address (hostname -I). Each member's spored then runs its own--on-complete, grace period and pre-stop hook.--mpi-commandthat path is unchanged.The
--mpi-commandflag help (and the regenerateddocs-gen/launch.md) now states this. The rationale lives in a Go comment rather than the template, to keep user-data under the 16 KB cap.Tests
pkg/userdata/mpi_completion_test.goruns rank 0's block of the rendered script under real bash withset -e, with stand-inmpirun/ssh/hostname/sleep. The ssh stand-in runs each remote command with that host's/tmpredirected, so each peer's files can be checked separately. The assertions come from the issue's Expected section and the--commandflag contract:TestMPICommandSignalsCompletion, for success (rc 0) and failure (rc 3): output (stdout and stderr) is in spawn-command.log, SPAWN_EXITCODE holds the rc, rank 0 has a SPAWN_COMPLETE with the right status and exit_code, and so does every peer.TestMPIPeerReadinessFailureSignalsReachablePeers: a peer that never accepts SSH means mpirun does not run, rank 0 records failed/1, the reachable peer gets the failed record, and the cause is in spawn-command.log.Each test was watched failing against reverts that compile: the original template (all fail), no peer signalling loop,
$?instead ofPIPESTATUS[0], and no tee.mpi_peer_readiness_test.gonow anchors on the readiness probe ("$PEER_IP" true) rather than the bareBatchMode=yes, which the completion hand-off also contains (CLAUDE.md gate rule 3). It also checks that the no-command failure record is still written.make checkpasses exceptTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Dockerinpkg/taskproto, which fails identically on clean main (needs a Docker daemon). No public-surface change.Not verified without AWS
No instances were launched. Not yet confirmed on hardware: peer
hostname -Iand the peers-file.ip(private IP) matching on a real cohort, and end-to-end cohort self-termination.Fixes #894