Repository navigation
Verify spored on fleet members and clean up failed fleet launches (#1305); poll every region in a rolling sweep (#1251) - #1314
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
force-pushed
the
fix/1305-1251-fleet-launch-safety
branch
from
October 26, 2026 04:02
c55e730 to
614a407
Compare
Merged
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.
Fixes #1305
Fixes #1251
What changed
Multi-instance launches now have the same guarantees v0.145.0 (#1298/#1303) gave a single
spawn launch. One helper provides them:fleetGuardincmd/launch_fleet.go.verifySporedReadyOn: the heartbeat tag, with SSM as a second signal). Members are verified in parallel, at most 16 at a time, against one shared deadline. A member that waited for a slot gets the rest of the budget, with a floor of 30 s for a final poll. So a fleet waits about as long as one instance, not 5 min per member. A member whose spored never comes up is terminated and reported. Its verified siblings are kept, because each is enforcing its own TTL.--keep-on-errorkeeps it instead. An explicit--wait-for-ssh=falseskips verification, as it does on a single launch.fleetGuard.finishis deferred over each path's named error. It terminates each recorded member exactly once, unless--keep-on-error.recordingLaunchAPI), so the guard knows every instance RunInstances returned. This includes the case where it isListInstancesthat failed after the reconcile, which is the case in the issue. The existing job-array-id drain still runs on a failed cohort. What it terminated is marked in the guard, and the guard terminates any member the tag scan missed.spawn array cancelhint.failures, instate.Failed, and recorded withstate: "failed".reconcileSweepStatenow counts that record as failed. Before, a terminated instance read as completed, sospawn resumewould never re-run the set. A plain job array still has to reach--min-viableverified members, and an MPI cluster needs every rank verified. Below that the launch fails and the guard terminates the rest.spored verified on N of M instance(s); K terminated because spored never came up (ids), plus any kept or failed-to-terminate members.ListInstancesper region per tick. A region whose call fails decides nothing about its members that tick. Correction to the issue's stated effect: the old code treated an instance missing from the first region's result as finished (!exists). So a member in another region was not stalled; it was taken as finished at once, and the queue launched past--max-concurrent. The gate asserts both points: the other region is polled, and at most one instance runs at a time.--keep-on-erroronspawn burstandspawn resume. Thespawn launch --keep-on-errorhelp now mentions fleets. docs-gen regenerated.A judgement call to review
The brief says "any failure after RunInstances that makes the command exit non-zero terminates every member". A foreground sweep with one failed row, from RunInstances or from verification, already exited non-zero. The code also documented that its successful rows are deliberately kept ("Parameter sets are independent"). I kept that behaviour. Per-member failures are a partial outcome (
fleetPartialError): the command still exits non-zero and names the failed sets, and verified siblings are kept. Only a failure of the launch itself (cohort failure, ListInstances error, burst stopping part way, reconcile error) tears everything down. A partial outcome can only be produced after every surviving member is verified. The same rule applies to a burst member that fails verification. The rolling queue'sctx.Donebranch (dead in production today:runLaunchusescontext.Background()) waits for in-flight verifications, which terminate their members on the cancelled context. Verified members are kept forspawn resume.Also: when every active slot of a rolling queue is empty because every launch in it failed, the queue now refills. Before, it hung forever, because nothing was ever removed from an empty active set.
Gates (each watched failing against a compiling revert)
finishnever terminatesrunArrayCohortwithout the deferredfinishTestJobArrayActuatorRecordsEveryLaunchInTheGuardcfgs[0].RegionTestRollingQueuePollsEveryRegionInTheSweepreconcileSweepStateignores the failed recordTestRollingQueueTerminatesAndFailsAnUnverifiedMemberTestFleetVerifySharesOneDeadlinefinishTestBurstStoppedPartWayTerminatesWhatItLaunchedTestJobArrayFailedCohortTerminatesEachMemberOnceTestSweepAllAtOnceTerminatesOnlyTheUnverifiedMemberTestRollingQueueTerminatesAndFailsAnUnverifiedMemberterminatenot idempotentTestFleetGuardTerminatesAMemberAtMostOnceTestSweepLaunchFailureKeepsVerifiedSiblingsEvery test counts Terminate calls through the
fleetTerminatorseam. None measures wall-clock time. The deadline test injectsnow.TestCohortFailureAlwaysDrains(a source-text gate) was updated to the drain's new call text.Checks
make check: everything passes exceptcheck-build-tags. That step fails identically on unmodified main in a/private/tmpworktree, which I verified by stashing these changes.make lint: 0 issues in all 10 modules.make check-docs: clean.semgrep scan --config=auto --error .: clean.No AWS calls were made. No new IAM:
TerminateandDescribeInstancesare the calls a single launch already makes.Not covered: detached (Lambda-orchestrated) sweeps. Filed as #1313.