Repository navigation
[Data][3/n] Migrate Shuffle V2 to Unified Phase Metrics - #67570
Conversation
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: HFFuture <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a structured framework for tracking and reporting metrics, block stats, and progress bars for individual phases of shuffle-family operators (such as map, reduce, shuffle, and finalize stages) via the new ShufflePhaseMetrics and ShuffleOperatorMetrics classes. Both CPU and GPU-based shuffle operators have been refactored to delegate metrics tracking to these phase-specific objects, enabling more granular observability. I have no feedback to provide as there are no review comments.
There was a problem hiding this comment.
🟡 Changes recommended
Skipped empty partitions inflate shuffle output estimates, while output-phase metrics double-count GPU-shuffle rows in dashboard dataset totals.
2 open issues
What changed in this PR
This stacked PR migrates Shuffle V2 to shared phase metrics, building on the instrumentation and GPU shuffle migrations. It consolidates task accounting, block statistics, and output estimates across shuffle operators.
Changes:
- Replaces duplicated V2 metrics logic with single-phase components and records map worker time.
- Adds shared phase reporting for GPU shuffle, including progress bars and Prometheus exports.
- Expands tests for metrics, statistics, progress, and output estimates.
| File | Description |
|---|---|
python/ray/data/tests/test_shuffle_phase_metrics.py |
Tests shared phase accounting and reporting. |
python/ray/data/tests/test_hash_shuffle_v2.py |
Tests V2 map metrics and reduce estimates. |
python/ray/data/tests/test_gpu_shuffle.py |
Tests GPU phase metrics, progress, and estimates. |
python/ray/data/tests/test_gpu_aggregate.py |
Checks aggregation progress labels and stats keys. |
python/ray/data/BUILD.bazel |
Registers the phase-metrics test target. |
python/ray/data/_internal/stats.py |
Exports phase snapshots and aggregates per-node metrics. |
python/ray/data/_internal/gpu_shuffle/hash_shuffle.py |
Integrates shared shuffle and finalize phases. |
python/ray/data/_internal/gpu_shuffle/hash_aggregate.py |
Reuses phase reporting with an aggregation label. |
python/ray/data/_internal/execution/streaming_executor.py |
Passes phase metrics to the stats manager. |
python/ray/data/_internal/execution/operators/shuffle_phase_metrics.py |
Introduces shared phase accounting and estimates. |
python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_reduce_operator.py |
Migrates reduce metrics and completion-time estimates. |
python/ray/data/_internal/execution/operators/shuffle_operators/shuffle_map_operator.py |
Migrates map metrics and reports worker time. |
python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_reduce_operator.py |
Migrates disk reduce metrics and estimates. |
python/ray/data/_internal/execution/operators/shuffle_operators/disk_shuffle_map_operator.py |
Migrates disk map metrics and reports partition totals. |
python/ray/data/_internal/execution/interfaces/physical_operator.py |
Adds the phase-metrics interface. |
python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py |
Allows phase snapshots to omit operator resource usage. |
Review effort: Balanced
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 4f47935. Configure here.
Signed-off-by: Sirui Huang <[email protected]>
…nto releases/2.61.0 (#68472) ## Description Cherry-pick of #68433 (`1729626bbb`) onto `releases/2.61.0`. Lets the upstream read or map fuse into the disk-shuffle writer, and sets the polars thread limit inside the task rather than through the runtime env. The pick applied without conflicts. Seven master commits that touch the same files are not on the release branch (#67143, #68158, #68202 and its revert #68383, #68319, #67570, #68118), so the picked files differ from master in five places. Reviewers from Data, please confirm none of those is a prerequisite. ## Testing Ran locally against the `releases/2.61.0` wheel (`7c8ca5ea51`) with the picked files overlaid: `test_hash_shuffle_v2.py`, `test_operator_fusion.py` and `test_execution_optimizer_advanced.py`, 232 passed, 2 skipped. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: You-Cheng Lin <[email protected]> Signed-off-by: elliot-barn <[email protected]> Co-authored-by: You-Cheng Lin <[email protected]>


Description
Migrates shuffle v2 onto the
ShuffleOperatorMetricscomponent from #66968. PR 3 of 3, stacked on #66968 and #67359.Today the four v2 operators (
ShuffleMapOp,ShuffleReduceOp,DiskHashShuffleMapOp,DiskHashShuffleReduceOp) each keep their own block-stats list and a copy of the output-estimate block. Map stages report 0 worker time andnum_outputs_total() is None; reduce stages recompute the estimate on every output bundle, and the disk reduce's estimate is stuck at 0.This PR gives each operator one phase (
maporreduce), aliased to the operator's own metrics, so every exported metric name and stats row is unchanged. What changes:num_outputs_total() == num_partitions.None.SortShuffleMapOpinherits the metrics unification changes introduced in this PR as it subclassesShuffleMapOp.Related issues
Stacked on #66968 and #67359. Related to #61636.
Additional information
The disk reduce still submits its tasks with an empty metrics bundle. Passing the wrapper's partition bytes would feed
obj_store_mem_pending_task_inputs, which the downstream capacity backpressure policy reads, so that is a backpressure change rather than a metrics one and is not made here.AI assistance (Claude Code) was used; every line was manually reviewed and locally tested.