Skip to content

MPI cohort AZ capacity fallback (Stage 1) - #371

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/mpi-cohort-stage1-az-fallback
Jul 19, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/mpi-cohort-stage1-az-fallback

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Stage 1 of the cohort MPI integration. Adds automatic Availability-Zone capacity fallback to MPI/job-array cohort launches — the headline capability the legacy loop lacks.

What

When the primary AZ returns InsufficientInstanceCapacity, the whole cohort advances to the next region AZ as a unit (all nodes in one surviving AZ, preserving the placement-group/one-AZ invariant). cohort's launchCollective already owns the shared-rung advance; this PR supplies the RungPlacement.Chain it walks.

  • pkg/aws/zones.go — new DescribeAvailabilityZones (available + standard AZs only; excludes Local/Wavelength zones).
  • cmd/launch_jobarray.go — buildAZChain (operator-selected AZ first, capped at maxAZFallbackRungs=4) + orderAZs; sets RungPlacement{Rung, Chain} on every member intent.

Scope guard

This stage enables the chain only when no cluster placement group is set. A pre-created PG binds to one AZ, so moving AZ mid-fallback would break it — resolved in Stage 3 (lazy per-AZ PG). With a PG set, or if AZ discovery fails, it degrades to single-rung (prior behavior). So no behavior change for today's PG-backed MPI launches; plain multi-AZ-eligible launches gain fallback.

Tests

  • TestOrderAZs — AZ ordering (preferred-first, absent, empty).
  • TestMPI_MultiAZChain_LandsAllInSurvivingAZ — extends the adapter fake with multi-AZ exhaustion (failAZs) and proves a 3-AZ chain with the first two exhausted lands all members in the third AZ.
  • go build ./..., pkg/aws + pkg/mpicohort + cmd tests green; gofmt clean.

Depends on Stage 0 (#370, merged). Part of the cohort MPI integration.

On InsufficientInstanceCapacity in the primary AZ, the MPI cohort now advances
its shared placement rung to the next region AZ as a unit — all nodes land in
one surviving AZ, preserving the placement-group/one-AZ invariant. cohort's
launchCollective already owns the shared-rung advance; this supplies the chain.

- pkg/aws/zones.go: DescribeAvailabilityZones (available + standard AZs only).
- cmd/launch_jobarray.go: buildAZChain (operator AZ first, capped at 4) +
  orderAZs; set RungPlacement.Chain on every member intent. Gated to the
  PG-absent case for now (a pre-created PG binds to one AZ; lazy per-AZ PG is a
  later stage) — degrades to single-rung on AZ-discovery failure.
- Tests: TestOrderAZs (cmd); TestMPI_MultiAZChain_LandsAllInSurvivingAZ extends
  the adapter fake with multi-AZ exhaustion (failAZs) and proves a 3-AZ chain
  lands all members in the one surviving AZ.

Stage 1 of the cohort MPI integration (plan: majestic-enchanting-kernighan).
@codecov

codecov Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_jobarray.go 44.64% 31 Missing ⚠️
pkg/aws/zones.go 0.00% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit d3d765f into main Jul 19, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/mpi-cohort-stage1-az-fallback branch July 19, 2026 00:17
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.

1 participant