Repository navigation
feat(resumption): implement paused task filtering during unpause replay - #972
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements task filtering logic during unpause resumption in the experiment state server. It introduces a new ShouldSkipTask function to evaluate paused tasks against their live WorkUnit state based on four terminal rules, updating the resumption worker to skip obsolete or terminal tasks. The feedback suggests adding defensive nil checks for the task object, its parent WorkUnit, and the current execution in both the resumption worker and the filtering logic to prevent potential nil pointer dereferences and server panics.
Extend pausedtask.PausedTask with its parent WorkUnit and define ResolutionStatusReplayed and ResolutionStatusSkipped. Implement ShouldSkipTask in resumption/filter.go to evaluate paused tasks against live WorkUnit state across the 4 terminal and obsolete rules, and wire filtering into ResumptionWorker.replayBatch. TAG=agy CONV=f9e059b6-7b63-42cf-aee9-8c4aaeabedd1
c3e84db to
3c8b388
Compare
AntonTyb
left a comment
There was a problem hiding this comment.
general design question - what is the approach to storing information/spec for the tasks going thru queue (aka Redis)? asking as this is a non-trival element as it represent (short term) state...
|
@AntonTyb The general flow is:
To directly answer your question: one note here: I still operate here on the in-memory stubs instead of Spanner as this is still work-in-progress but this is the direction. |
so let me phrase this question differently - if the current setup is implemented as is and we make changes to the structure of the message going thru the queue - will it result in Major or Minor or Patch version change (assuming no other changes)? and then on user side - when rollout occurs with some message in the queue - will new code be always able to deal with new message structure or can it result in a breaking (non-backward compatible) change and thus should be flagged as a bigger change? |
AntonTyb
left a comment
There was a problem hiding this comment.
correlation to versions and backward compatiblity question asked in comment
|
@AntonTyb Overall the convention of working with protobufs is to never introduce breaking changes at once (by that I mean e.g. changing the type of existing fields) - it should always follow the pattern of deprecating old fields and introducing new ones. There should always be a transition window in which both structures are supported by the code, and that marks the distinction between minor and major bump depending on when we drop the fallback code. Let's say that an invasive change is being made to action proto - at this point the Actuator must still handle messages that have an older payload. This is not unique to pause scheduling: an upgrade can happen while tasks are in-flight in the Redis queue, and those older messages need to be handled cleanly after the rollout. What pause scheduling changes is the timeframe for how long a message can be persisted: seconds in normal queue operations vs. hours or days for paused tasks. So to answer directly:
|
and the proposed implementation will support this behavior? |
Summary
Adds live WorkUnit task filtering to the ESS unpause resumption worker so obsolete and terminal tasks are marked with
skippedresolution status (with structured skip reasons logged) instead of being replayed to Kubernetes.Key Changes
internal/storage/spanner/pausedtask: ExtendedPausedTaskwithWorkUnit *essmsgpb.WorkUnit(with deep-copy isolation inFake) and definedResolutionStatusReplayed = "replayed"andResolutionStatusSkipped = "skipped".cmd/experiment_state_server/resumption/filter.go: ImplementedShouldSkipTaskevaluating the 4 filtering rules (superseded execution ID, terminal execution state, update while paused, and stale update priority), returning(bool, TaskFilterReason).cmd/experiment_state_server/resumption/worker.go: IntegratedShouldSkipTaskand parentWorkUnitintegrity checks intoreplayBatch, logging the skip reason and marking skipped tasks withResolutionStatusSkipped. Passedtask.WorkUnittoEnqueueWorkUnitTaskfor replayed tasks.filter_test.go,worker_test.go, andfake_test.go.Verification
bazel test //cmd/experiment_state_server/resumption/... //internal/storage/spanner/pausedtask/...(Passed)./.githooks/pre-commit(Passed)TAG=agy
CONV=f9e059b6-7b63-42cf-aee9-8c4aaeabedd1