Skip to content

Lazy per-AZ placement group: AZ fallback + placement groups together (MPI cohort Stage 3) - #374

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/mpi-cohort-stage3-lazy-pg
Jul 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/mpi-cohort-stage3-lazy-pg

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Stage 3 of the cohort MPI integration — the central correctness point. Makes AZ capacity fallback (Stage 1) coexist with a cluster placement group.

The problem

A cluster placement group binds to the AZ of its first instance. The auto PG was created up front in one AZ (in runLaunch), which is fundamentally incompatible with the cohort moving to another AZ on InsufficientInstanceCapacity — the pre-bound PG can't follow. That's why Stage 1 gated AZ fallback off whenever a PG was set.

The fix — lazy, per-AZ, owned by the Actuator

  • Actuator: a PlacementGroupPrefix makes it create spawn-mpi-<name>-<az> on demand as the cohort enters each AZ (create-once per AZ, mutex-guarded; idempotent create tolerates already-exists), set it on that launch, and track the names (CreatedPlacementGroups). A fresh name per AZ sidesteps the sticky-AZ-affinity of reusing one name across drain→advance→relaunch rounds. LaunchAPI gains Create/DeletePlacementGroup.
  • runLaunch: for --auto-placement-group, stash config.PlacementGroupPrefix instead of eager-creating a single-AZ PG (leaving PlacementGroup empty so fallback stays on). An explicit --placement-group is unchanged — fixed, AZ-bound, single-rung (no fallback), since it's user-managed.
  • launchCohort: passes the prefix to the Actuator and, after reconcile, best-effort deletes the PGs for abandoned AZs (keeps only the surviving AZ's; deletes all on failure).
  • The Stage-1 buildAZChain gate now keys on a fixed PlacementGroup, so auto-PG MPI launches finally get AZ fallback.

Tests

  • TestActuator_PerAZPlacementGroup — primary AZ exhausted → cohort advances a→b; asserts exactly one PG created per visited AZ (create-once despite 4 members/round), all instances land in the surviving AZ, and both PGs are tracked for cleanup.
  • TestPlacementGroupName — per-AZ naming (distinct AZs → distinct names).
  • Fake LaunchAPI implements the two new methods. go build ./..., pkg/mpicohort/cmd tests, e2e tier0 (local), gofmt clean. (Pre-existing unrelated TestCatalogValid failure, feat(plugin): permissions declaration block (#388) #392, is not from this change.)

Depends on Stages 1 & 2 (#371, #373, merged). Next: Stage 4 (SSM control-plane Assembler).

…age 3)

A cluster placement group binds to the AZ of its first instance, so the old
eager up-front PG creation was incompatible with AZ fallback. The cohort now
manages the auto PG lazily and per-AZ:

- Actuator: PlacementGroupPrefix → create spawn-mpi-<name>-<az> on demand before
  launching into that AZ (create-once per AZ via a mutex-guarded set), set it on
  the launch, and track created names (CreatedPlacementGroups). New
  PlacementGroupName helper. LaunchAPI gains Create/DeletePlacementGroup.
- runLaunch: for --auto-placement-group, stash config.PlacementGroupPrefix instead
  of eager-creating a single-AZ PG (leaving PlacementGroup empty so fallback stays
  on). Explicit --placement-group is unchanged (fixed, AZ-bound, single-rung).
- launchCohort: pass the prefix to the Actuator; after reconcile, best-effort
  delete abandoned-AZ PGs (keep only the surviving AZ's).
- buildAZChain gate now keys on a FIXED PlacementGroup (not the auto prefix), so
  auto-PG MPI launches get AZ fallback.
- Tests: TestActuator_PerAZPlacementGroup (one PG per visited AZ, create-once,
  all instances in surviving AZ, both tracked) + TestPlacementGroupName; fake
  LaunchAPI implements Create/DeletePlacementGroup.

Stage 3 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 42.46575% with 42 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_jobarray.go 6.25% 30 Missing ⚠️
cmd/launch_single.go 0.00% 6 Missing ⚠️
pkg/mpicohort/adapter.go 82.85% 4 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 959bf76 into main Jul 19, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/mpi-cohort-stage3-lazy-pg branch July 19, 2026 00:57
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