Repository navigation
refactor(pausescheduling): centralize pause scheduling repos and run pause writes in transactions - #1043
Merged
Conversation
…ites in transactions Initialize the pause state and paused task repositories inside storage (still in-memory fakes) and expose them via PauseState()/PausedTasks(), so switching to Spanner later is a single-place change. The actuator and ESS now take the repos from storage instead of creating fakes themselves. The actuator pause handler and the ESS resumption worker registration now run inside RunInTransaction. The work unit status update goes through the new WorkUnitTxRepository.UpdateWorkUnitStatus. The pause repos are still called through their non-tx accessors; binding them to the transaction is a follow-up. TAG=agy CONV=aca941d1-8c29-4820-96a9-0200c1071207
There was a problem hiding this comment.
Code Review
This pull request refactors the pause scheduling mechanism to use a transactional approach for buffering tasks and updating work unit execution statuses. It introduces a TransactionRunner interface to ensure atomicity, updates the Storage interface to expose repositories for pause state and paused tasks, and migrates status updates to use a more robust UpdateWorkUnitStatus method. My feedback highlights the need for a nil-check when fetching work units to prevent potential panics and suggests using spanner.CommitTimestamp for database update times to avoid clock skew issues.
andrzejfudro
marked this pull request as ready for review
September 30, 2026 15:27
Wrap batch resolution persistence in w.txRunner.RunInTransaction in ResumptionWorker.replayBatch so all pause scheduling writes execute within a transaction boundary. TAG=agy CONV=aca941d1-8c29-4820-96a9-0200c1071207
pachopepe
reviewed
Oct 1, 2026
…xecutions Replace the status-only UpdateWorkUnitStatus mutation with a transaction-scoped TxRepository.UpdateWorkUnitExecutions that runs the existing merge, current execution ID check, state transition guard, status history and experiment status denormalization inside the caller's read-write transaction. The transaction body of Repository.UpdateWorkUnitExecutions is moved unchanged into a shared helper. Rename updateExecutionStatus to markExecutionSchedulingPaused. TAG=agy CONV=aca941d1-8c29-4820-96a9-0200c1071207
andrzejfudro
force-pushed
the
feat/pause-scheduling-storage-prep
branch
from
October 1, 2026 12:46
7e4e15b to
53196b1
Compare
pachopepe
approved these changes
Oct 1, 2026
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.
Author note
There will be a follow up PR with linking pause repositories with transactions. This is split to keep PRs smaller and overall all of it is done to make PR that will add migration and real spanner implementation as small as possible.
Summary
Prepares pause scheduling for Spanner: pause repos are now created in one place (storage, still as fakes), and pause writes in the actuator and ESS run inside
RunInTransaction.Key Changes
PauseSchedulingStore(PauseState()/PausedTasks()) onstorage.Storage, backed by fakes inspanner.gofor now. NewWorkUnitTxRepository.UpdateWorkUnitStatus.HandlePausecreates the paused task and setsSCHEDULING_PAUSED(read-modify-write viatx.WorkUnits) in a single transaction. Prod wiring takes the repos from storage.MockStorageas the tx runner, plus tx failure cases.Verification
bazel test //internal/storage/... //cmd/actuator/... //cmd/health_service/... //cmd/experiment_state_server/...(Passed)TAG=agy
CONV=aca941d1-8c29-4820-96a9-0200c1071207