Repository navigation
fix(resume): record relaunched params by parameter index and merge into the sweep state (#1248) - #1252
Merged
Conversation
…to the sweep state (#1248) spawn resume launched only the pending parameter sets, but launchWithRollingQueue wrote a fresh state with TotalParams = len(pending) and each instance at its position in the pending list. A second resume then treated the wrong params as done and relaunched completed work. launchWithRollingQueue now takes the state to append to and a parallel []int of parameter indices. The fresh sweep passes a new state and identity indices; resume passes the loaded state and the pending indices via relaunchPending. Reconcile is extracted as reconcileSweepState so it can be gated. Fixes #1248
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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 #1248
Stacked on #1234, which changes the same resume code and records each instance's region. The base is
fix/connect-resume-57-495so this diff shows only this fix. Once #1234 merges, rebase onto main and retarget this PR.The bug.
spawn resumebuilds launch configs only for the pending parameter indices.launchWithRollingQueuethen wrote a fresh sweep state:TotalParamswaslen(pending), not the sweep's size.A second resume then read the wrong parameters as done and launched completed work again. That is duplicate compute.
The fix:
launchWithRollingQueuenow takes the state to append to, plus a parallel[]intof parameter indices. Both recording sites (the initial batch and the rolling loop) recordparamIndices[pos]. The failure and progress messages use those indices too.launchParameterSweep) passes a new state and the identity indices, so its behaviour is unchanged.relaunchPending, which passes the loaded state. The completed and running records,TotalParams,ParamFile,CreatedAtand the name all survive. Running and Failed counts are added on top of the reconciled ones.reconcileSweepState, so it can be gated.launchWithRollingQueuetakes a two-methodsweepLauncherinterface, which*aws.Clientsatisfies. The poll interval is now a var, so tests don't wait 10s.Gates (
cmd/resume_indices_test.go, using a fake launcher and fake EC2 states):TestResume_RelaunchRecordsParameterIndicesAndMergesState: a saved state has completed {0,1,2,4,5,6,8,9}. The first reconcile finds pending [3 7].relaunchPendingruns with maxConcurrent=1, so it exercises both the initial-batch and the rolling-loop recording paths. Afterwards the reloaded state still has TotalParams=10 and the metadata. It has the new instances at Index 3 and 7, keeps all eight completed records, and has no duplicate index. A second reconcile finds nothing pending.TestLaunchWithRollingQueue_FreshSweepRecordsEveryIndex: the normal-sweep caller still records Index 0..2 with TotalParams 3.TestRunResume_RelaunchesThroughTheLoadedState: an AST check thatrunResumecallsrelaunchPendingwith its loadedstateand never callslaunchWithRollingQueuedirectly.Each gate fails against a revert that compiles:
relaunchPendinggiven a fresh state:TotalParams = 2 after resume, want 10, and all eight completed records are lost.runResumepassing a fresh&SweepState{}: the AST gate fails.Checks:
make check: every step passes exceptcheck-build-tags. That step also fails on unmodified origin/main on this machine, because of the /private/tmp paths.make lint: 0 issues.semgrep scan --config=auto --error .: clean.Reopened as a fresh PR against main: #1250 was stacked on #1234 and GitHub closed it when #1234 merged and its branch was deleted. This PR is rebased onto main and carries only the #1248 commit.