[Data] Fix flaky test_streaming_split_stats#64290
Merged
goutamvenkat-anyscale merged 1 commit intoJun 23, 2026
Merged
Conversation
The task_output_backpressure_time* metrics on the running MapBatches operator are wall-clock timers for output backpressure, which is a timing race against the single, slower streaming-split consumer. The value is genuinely nondeterministic across runs (sometimes 0, usually positive), but the test hardcoded it to zero (Z), so it only passed on the occasional fast run (~1/5 locally). Mark just those three timer values as not-asserted (a "<varies>" sentinel on both expected and produced) for the running operator only. Everything else stays strictly checked: task_submission_backpressure_time remains N, and the idle split operator's backpressure timers remain strictly asserted as 0. Verified: test_streaming_split_stats now passes 10/10 (was 1/5); test_dataset__repr__ and test_dataset_stats_basic still pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates test_streaming_split_stats in python/ray/data/tests/test_stats.py to handle nondeterministic task_output_backpressure_time metrics. It replaces these metrics with a <varies> sentinel in both the expected and produced stats to prevent flaky test failures caused by timing races. There are no review comments, so no feedback is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
edoakes
approved these changes
Jun 23, 2026
owenowenisme
approved these changes
Jun 23, 2026
limarkdcunha
pushed a commit
to limarkdcunha/ray
that referenced
this pull request
Jun 30, 2026
## Why `test_streaming_split_stats` is flaky. The `task_output_backpressure_time*` metrics on the running `MapBatches` operator are wall-clock timers for output backpressure, which is a timing race against the single, slower `streaming_split(1)` consumer. The value is genuinely nondeterministic across runs (sometimes `0`, usually positive), but the test hardcoded it to zero (`Z`), so it only passed on the occasional fast run (~1/5 locally; also seen failing in CI). Empirically, output backpressure is the *normal* state for this pipeline (nonzero ~every run), so the hardcoded `Z` was the less-representative outcome. There is no deterministic value to assert for a wall-clock timer, so the honest fix is to stop asserting its magnitude rather than force a value. ## What Scoped, test-only change inside `test_streaming_split_stats`: - Mark just the three timer values (`average_task_output_backpressure_time_s`, `task_output_backpressure_time`, `task_output_backpressure_time_s`) as **not-asserted** (a `<varies>` sentinel applied to both the expected and produced stats) — but **only for the running `MapBatches` operator** (first occurrence). - Everything else stays strictly checked: - `task_submission_backpressure_time` remains `N`. - The idle `split` operator's backpressure timers remain strictly asserted as `0`. - All other fields and all other tests are untouched (no change to `canonicalize()` or `gen_expected_metrics()`). This mirrors the existing precedent for `obj_store_mem_used` (collapsed to `A` because it's "zero or positive depending on the run"). ## Verification - `test_streaming_split_stats`: **10/10 pass** (was 1/5). - `test_dataset__repr__`, `test_dataset_stats_basic`: still pass (strict, unchanged). - `pre-commit`: clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
test_streaming_split_statsis flaky. Thetask_output_backpressure_time*metrics on the runningMapBatchesoperator are wall-clock timers for output backpressure, which is a timing race against the single, slowerstreaming_split(1)consumer. The value is genuinely nondeterministic across runs (sometimes0, usually positive), but the test hardcoded it to zero (Z), so it only passed on the occasional fast run (~1/5 locally; also seen failing in CI).Empirically, output backpressure is the normal state for this pipeline (nonzero ~every run), so the hardcoded
Zwas the less-representative outcome. There is no deterministic value to assert for a wall-clock timer, so the honest fix is to stop asserting its magnitude rather than force a value.What
Scoped, test-only change inside
test_streaming_split_stats:average_task_output_backpressure_time_s,task_output_backpressure_time,task_output_backpressure_time_s) as not-asserted (a<varies>sentinel applied to both the expected and produced stats) — but only for the runningMapBatchesoperator (first occurrence).task_submission_backpressure_timeremainsN.splitoperator's backpressure timers remain strictly asserted as0.canonicalize()orgen_expected_metrics()).This mirrors the existing precedent for
obj_store_mem_used(collapsed toAbecause it's "zero or positive depending on the run").Verification
test_streaming_split_stats: 10/10 pass (was 1/5).test_dataset__repr__,test_dataset_stats_basic: still pass (strict, unchanged).pre-commit: clean.🤖 Generated with Claude Code