test(amber): add unit test coverage for ExecutionUtils#4570
Merged
aglinxinyuan merged 4 commits intoapache:mainfrom Apr 30, 2026
Merged
test(amber): add unit test coverage for ExecutionUtils#4570aglinxinyuan merged 4 commits intoapache:mainfrom
aglinxinyuan merged 4 commits intoapache:mainfrom
Conversation
### What changes were proposed in this PR? Add `ExecutionUtilsSpec` covering the three pure aggregator functions exposed by `ExecutionUtils`: - `aggregateStates` — empty, all-completed, all-terminated, has-running, all-uninitialized, all-paused, all-ready (maps to RUNNING), and mixed (UNKNOWN) - `aggregatePortMetrics` — empty, single mapping, sum on same port, group by port id when ports differ - `aggregateMetrics` — empty defaults, scalar sums and per-port merges across operators, and internal-port filtering ### Any related issues, documentation, discussions? Closes apache#4569 ### How was this PR tested? `sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.controller.execution.ExecutionUtilsSpec"` — 15/15 tests pass. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.7) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Yicong-Huang
approved these changes
Apr 30, 2026
Contributor
Yicong-Huang
left a comment
There was a problem hiding this comment.
can you add some anti cases that should be prevented?
Address review feedback on PR apache#4570: cover defensive and precedence cases that previously had no assertions. aggregateStates: - mixed completed + terminated falls through to UNKNOWN (neither forall branch matches) - running takes precedence over completed and terminated; single running input also resolves to RUNNING - no-completed inputs still classify as PAUSED / UNINITIALIZED / RUNNING (all-ready) - a value matching none of the sentinels resolves to UNKNOWN rather than being silently classified aggregatePortMetrics: - three or more mappings on the same port are summed without loss - multiple ports each with multiple mappings are summed independently per port - a zero-count, zero-size mapping is preserved, not dropped aggregateMetrics: - a single operator's statistics are preserved (modulo internal-port filtering) - a running + completed operator pair aggregates to RUNNING - two completed operators aggregate to COMPLETED with summed scalars - operators with empty per-port stats coexist with non-empty operators while scalar sums still update
Contributor
Author
|
Thanks for the review @Yicong-Huang. Pushed 3675f94 with 11 additional cases (15 → 26 tests, all passing):
|
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.
What changes were proposed in this PR?
Add
ExecutionUtilsSpeccovering the three pure aggregator functions exposed byExecutionUtils(amber/src/main/scala/org/apache/texera/amber/engine/architecture/controller/execution/ExecutionUtils.scala):aggregateStates— empty, all-completed, all-terminated, has-running, all-uninitialized, all-paused, all-ready (maps to RUNNING), and mixed (UNKNOWN)aggregatePortMetrics— empty, single mapping, sum on same port, group by port id when ports differaggregateMetrics— empty defaults, scalar sums and per-port merges across operators, and internal-port filteringAny related issues, documentation, discussions?
Closes #4569
How was this PR tested?
sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.controller.execution.ExecutionUtilsSpec"— 15/15 tests pass.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)