Skip to content

--keep-on-error is ignored for failed --mpi cohorts, and the CLI reports an already-terminated instance as kept #1509

Open

Description

@scttfrdmn

Summary

For an --mpi cohort that fails, --keep-on-error keeps nothing, and spawn then reports that it kept an instance it had already terminated.

Evidence (live, us-east-1, 2026-11-02, CLI built from PR #1506 head 060fdf6)

spawn launch liveefa-ub2 --count 2 --mpi --efa --instance-type c7gn.16xlarge --ami <ubuntu 24.04 arm64> --spot --ttl 1h --on-complete terminate --keep-on-error --yes ...
⚠️  Cohort failed; draining any launched instances...
   drained i-04cff432582e83c5d (running)
   drain: terminated 1 instance(s)
⚠️  The MPI cluster launch failed after creating 1 instance(s); keeping them (--keep-on-error): i-034180ce1059913a6

CloudTrail TerminateInstances calls, both made by the spawn CLI's own credentials:

2026-11-02T20:36:55Z  i-034180ce1059913a6   <- the instance reported as "kept"
2026-11-02T20:36:56Z  i-04cff432582e83c5d   <- the drain

Both members were terminated when the command returned. Two other problems show in the same output:

  • "after creating 1 instance(s)": 2 were created. The run without --keep-on-error printed the same miscount.
  • The cohort itself terminated i-034180ce1059913a6, the cancelled survivor, before the guard ran. So guard.live() still listed it, and the message named it as kept.

Cause (code)

  • cmd/launch_jobarray.go (~L840): the cohort-failure path always calls drainJobArray, whatever keepOnError is. The comment calls that deliberate ("Always draining is the only defensible default").
  • fleetGuard.finish (cmd/launch_fleet.go ~L318) then prints "keeping them" for whatever is left in live(). That list includes instances the cohort terminated without marking them gone.

Impact

The failure is on the safe side: nothing leaks. But the help text promises "For a job array or sweep, keep every member when the launch fails part way", and for --mpi that isn't true. This blocks diagnosis, because you can't keep a failed MPI node to read its cloud-init log, and that's exactly when you'd pass the flag. The "kept" message also tells the user to spawn terminate an instance that is already gone.

Expected

Either honour --keep-on-error for MPI cohort failures, skipping the drain and the cohort's survivor cancel, or refuse/warn that it has no effect with --mpi. Either way, only name an instance as kept if it is still live.

Activity

  1. added
    bug
    on Nov 2, 2026
  2. modified the milestones: Later, Hardening on Nov 2, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions