Skip to content

fix(amber): emit ExecutionStateUpdate after resume - #4515

Closed
Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:fix/resume-handler-emit-state
Closed

Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:fix/resume-handler-emit-state

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

ResumeHandler.resumeWorkflow (ResumeHandler.scala) finished by sending ExecutionStatsUpdate and RuntimeStatisticsPersist to the client but never sent ExecutionStateUpdate. PauseHandler.scala:88-90 emits the corresponding state event at the end of pause, so the asymmetry meant clients (and tests) had no event-driven signal for the resume → RUNNING transition.

The aggregated state is already correct on the server side after the per-worker resume futures resolve (each workerInterface.resumeWorker(...) returns a WorkerStateResponse and ResumeHandler updates the internal WorkerExecution state with that result, so cp.workflowExecution.getState returns RUNNING). The fix is to broadcast it:

 sendToClient(ExecutionStatsUpdate(stats))
 sendToClient(RuntimeStatisticsPersist(stats))
+sendToClient(ExecutionStateUpdate(cp.workflowExecution.getState))

Any related issues, documentation, discussions?

Closes #4514

How was this PR tested?

sbt WorkflowExecutionService/compile succeeds; scalafmtCheckAll clean. The two existing consumers of ExecutionStateUpdate (ExecutionStatsService.scala:209 and ExecutionConsoleService.scala:204) already handle WorkflowAggregatedState.Recognized, so an additional RUNNING emit at resume time is a strictly additive event. No existing test asserts the absence of this event. Relying on CI for the full backend test run.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)

ResumeHandler.resumeWorkflow finished by sending ExecutionStatsUpdate
and RuntimeStatisticsPersist to the client but never sent
ExecutionStateUpdate. PauseHandler emits the corresponding state event
at the end of pause, so the asymmetry meant clients (and tests) had no
event-driven signal for the resume → RUNNING transition; consumers had
to fall back to Thread.sleep or rely on stats events.

The aggregated state is already correct on the server side after the
per-worker resume futures resolve, so the fix is just to broadcast it.

Closes apache#4514
Yicong-Huang added a commit to Yicong-Huang/texera that referenced this pull request Apr 26, 2026
Once apache#4515 (ResumeHandler emits ExecutionStateUpdate) lands, the
post-resume Thread.sleep(400) in PauseSpec.shouldPause can be replaced
with stateReached(client, RUNNING). The test verifies pause/resume
mechanics; it does not need to ensure tuple-level progress between
the two pause-resume cycles, so a state-based wait is sufficient.

Marks this PR as dependent on apache#4515.
@Yicong-Huang

Copy link
Copy Markdown
Contributor Author

Closing — the test motivation for this change can be solved without a new event broadcast: Await.result(resumeWorkflow) already blocks until all workers have transitioned to RUNNING (the resumeWorkflow Future completes inside ResumeHandler's .map block, after every worker future has resolved with its updated state). Adding a duplicate ExecutionStateUpdate(RUNNING) emit would only mean an extra round-trip on every resume, with no behavior change for existing consumers (web layer already sets RUNNING via .onSuccess).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResumeHandler does not broadcast ExecutionStateUpdate

1 participant