Skip to content

fix(resume): record relaunched params by parameter index and merge into the sweep state (#1248) - #1250

Closed
scttfrdmn wants to merge 2 commits into
fix/connect-resume-57-495from
fix/1248-resume-indices
Closed

scttfrdmn wants to merge 2 commits into
fix/connect-resume-57-495from
fix/1248-resume-indices

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1248

Stacked on #1234, which changes the same resume code and records each instance's region. The base is fix/connect-resume-57-495 so this diff shows only this fix. Once #1234 merges, rebase onto main and retarget this PR.

The bug. spawn resume builds launch configs only for the pending parameter indices. launchWithRollingQueue then wrote a fresh sweep state:

  • TotalParams was len(pending), not the sweep's size.
  • Each instance was recorded at its position in the pending list, not at its parameter index.

A second resume then read the wrong parameters as done and launched completed work again. That is duplicate compute.

The fix:

  • launchWithRollingQueue now takes the state to append to, plus a parallel []int of parameter indices. Both recording sites (the initial batch and the rolling loop) record paramIndices[pos]. The failure and progress messages use those indices too.
  • A fresh sweep (launchParameterSweep) passes a new state and the identity indices, so its behaviour is unchanged.
  • Resume goes through the new relaunchPending, which passes the loaded state. The completed and running records, TotalParams, ParamFile, CreatedAt and the name all survive. Running and Failed counts are added on top of the reconciled ones.
  • The reconcile loop moved unchanged into reconcileSweepState, so it can be gated.
  • launchWithRollingQueue takes a two-method sweepLauncher interface, which *aws.Client satisfies. 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]. relaunchPending runs 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 that runResume calls relaunchPending with its loaded state and never calls launchWithRollingQueue directly.

Each gate fails against a revert that compiles:

  • Position index at both sites: records at 0 and 1 overwrite the completed ones, and 3 and 7 are missing.
  • Position index at the rolling-loop site only: 7 is recorded at 1.
  • relaunchPending given a fresh state: TotalParams = 2 after resume, want 10, and all eight completed records are lost.
  • runResume passing a fresh &SweepState{}: the AST gate fails.

Checks:

  • make check: every step passes except check-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.
  • No help text changed, and no exported pkg symbols changed.

…esume never guesses a region (#57, #495)

connect: the shell/one-shot and DCV app paths share wakeForConnect; a stopping
instance is waited out then started; hibernated is reported as resuming; the
app path now honours --no-start.

resume: per-instance region recorded in sweep state at launch; resume
reconciles each instance in its recorded/param/configured region and errors
asking for --region instead of panicking on a param file with no region
default or falling back to us-east-1.
…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
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