Repository navigation
[data][actor-only][6/n] Scheduling loop + actor-only metrics [DO NOT MERGE] - #67702
iamjustinhsu wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an experimental 'actor-only' backend for Ray Data's streaming executor, designed to improve performance and resource management by utilizing a pull-based dispatch model and a centralized resource reporter. Key changes include the introduction of an OperatorSizer for actor pool management, a deadlock escape hatch for output limits, and comprehensive new Prometheus metrics for monitoring the actor-only backend. I have reviewed the changes and identified two critical issues: an unsafe assert in the metrics accounting that could crash the executor, and an IndexError risk in the input-moving logic for multi-input operators. Please address these before merging.
| ) | ||
| freed_bytes = cumulative.output_bytes.sum - live_pulled_bytes | ||
| freed_blocks = cumulative.output_bytes.num_samples - live_pulled_blocks | ||
| assert freed_bytes >= 0 and freed_blocks >= 0, (freed_bytes, freed_blocks) |
There was a problem hiding this comment.
Using an assert statement here can crash the entire dataset execution in production if there is any slight mismatch or floating-point precision issue in metrics accounting. Metrics should be robust and best-effort, and should never crash the main execution loop. It is much safer to clamp the values to 0.0 instead of asserting.
| assert freed_bytes >= 0 and freed_blocks >= 0, (freed_bytes, freed_blocks) | |
| freed_bytes = max(0.0, freed_bytes) | |
| freed_blocks = max(0.0, freed_blocks) |
| # A completed operator (e.g. an early-finishing limit) must not be fed | ||
| # further inputs. | ||
| if not op.has_completed(): | ||
| while op_state.has_pending_input_bundles(): |
There was a problem hiding this comment.
op_state.has_pending_input_bundles() returns True if any input queue has bundles. However, move_input_into_op() pops from all input queues. For multi-input operators (such as Zip or Union), if the queues are unbalanced, this will cause an IndexError when popping from an empty queue, crashing the executor. To support multi-input operators robustly, we should only move inputs when all input queues have pending bundles.
| while op_state.has_pending_input_bundles(): | |
| while op_state.input_queues and all(len(q) > 0 for q in op_state.input_queues): |
e747867 to
903e436
Compare
| limits = ExecutionResources.zero() | ||
| for bundle in self._autoscaling_coordinator.get_reserved_resources().values(): | ||
| limits = limits.add(ExecutionResources.from_resource_dict(bundle)) | ||
| return limits |
There was a problem hiding this comment.
Object store limits stay at zero
Medium Severity
get_global_limits only sums coordinator reserved bundles. Those bundles carry CPU, GPU, and heap memory, not object_store_memory, so the object-store limit stays 0. The utilization gauge then divides live bank usage by 0 and records 0% object-store utilization, so the autoscaler never scales on object-store pressure and the cluster panel stays flat.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 903e436. Configure here.
817c36b to
24e6a10
Compare
a4a17e7 to
d87a015
Compare
d87a015 to
ae31d17
Compare
ae31d17 to
2d8d7bb
Compare
2d8d7bb to
61dc113
Compare
89f39fd to
4890fd0
Compare
| freed_bytes = max(0.0, freed_bytes) | ||
| freed_blocks = max(0, freed_blocks) |
There was a problem hiding this comment.
Nit: Should we have an assertion here, if it is unexpected behaviour for freed_bytes and freed_blocks to be negative?
Could help us catch bugs / reason about failures.
4890fd0 to
0930246
Compare
0930246 to
4f69fb0
Compare
0930246 to
02be313
Compare
- adds a new experimental scheduling executor + progress logs + metrics + dashboard which will be used when actor only backend is enabled. - adds placeholders for the operator sizer which will be filled in in the next pr in the stack Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]> Co-authored-by: sampan <[email protected]> Co-authored-by: Prasad Palkar <[email protected]>
02be313 to
351c107
Compare
Signed-off-by: iamjustinhsu <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 13003f7. Configure here.
| rows_per_bundle = max(1, self._buffer.num_rows() // max(1, len(self._buffer))) | ||
| locality_rows = math.ceil(self._max_buffer_size) * rows_per_bundle | ||
| equal_rows = self.num_output_splits() * rows_per_bundle if self._equal else 0 | ||
| return max(locality_rows, equal_rows) |
There was a problem hiding this comment.
Splitter row estimate defaults to one
Low Severity
OutputSplitter.min_num_rows_needed_to_make_progress uses average rows per buffered bundle, and when the buffer is empty that average collapses to 1. The escape hatch then treats num_output_splits (or _max_buffer_size) rows as enough for an equal or locality split. Real bundles are typically thousands of rows, so a backpressured producer holding less than a split's worth of data can look un-starved and the hatch never raises the output limit.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 13003f7. Configure here.
Signed-off-by: iamjustinhsu <[email protected]>
Signed-off-by: iamjustinhsu <[email protected]>
Signed-off-by: iamjustinhsu <[email protected]>
interfaces/common.py keeps both sides' type aliases: this branch's PlacementGroupIdStr and master's OperatorId and TaskIndex (#68400). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]>


Summary
Add the actor-only backend's scheduling loop (an experimental streaming executor), its progress output, metrics and dashboard. This is the first PR where the flag actually switches backends; the operator sizer is a placeholder until the next PR.
Part 6 of 12 of the Ray Data actor-only backend stack. Stacked on #67701; review only the top commit. Everything here is gated behind
RAY_DATA_ACTOR_ONLY_BACKEND(off by default) unless noted under After.Before
With or without the flag, the classic
StreamingExecutorloop drives execution.DataOpTask.on_data_readytakes a byte budget, andprocess_completed_taskscounts errored blocks in a nested closure.After
ResourceReporterview for the cluster utilization gauge.on_data_ready(max_to_read=TaskPullRequest, ...)returns aTaskPullResponse._handle_data_op_task_exception.OpStategets an index, andhas_pending_bundlesbecomeshas_pending_input_bundles.flowchart TD subgraph Before subgraph BS[Subsystem: execution] subgraph BC[Component: streaming executor] B1[StreamingExecutor loop] --> B2["on_data_ready(max_bytes)"] end end end subgraph After subgraph AS[Subsystem: execution] subgraph AC[Component: streaming executor] A0{flag on?} -->|no| A1[StreamingExecutor loop] A0 -->|yes| A5["experimental scheduling loop: refresh -> pull -> dispatch -> size(placeholder)"] A1 --> A2["on_data_ready(TaskPullRequest)"] A5 --> A2 end end subgraph AO[Subsystem: observability] A6[actor-only metrics + dashboard] end end class A0,A5,A6 added class A2 changed classDef removed fill:#ffcdd2,stroke:#c62828,color:#000 classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 classDef changed fill:#fff9c4,stroke:#f9a825,color:#000Implementation notes
The cluster utilization gauge now reads through a
ResourceReporterprotocol (get_global_usage,get_global_limits,is_blocked_on_consumer), so either backend can feed it.ActorOnlyResourceReporter.is_blocked_on_consumer()returnsFalse: the actor-only backend doesn't track consumer blocking, so the autoscaler never skips a scale-up for it.Subsystems
execution (behavioral change, flag-gated; classic path gets the mechanical
TaskPullRequest/ error-accounting refactor), resource allocation (utilization gauge input), observabilityTesting
Each run used a clean checkout of this branch. Any test that failed was rerun on unmodified
masterin the same environment; only failures that pass on master count as regressions.RAY_DATA_ACTOR_ONLY_BACKEND=1 pytest python/ray/data/tests/actor_only: 176 passed.pytest python/ray/data/tests/test_streaming_executor.py: 57 passed.pytest python/ray/data/tests/test_lineage_reconstruction.py: 30 passed.pytest python/ray/data/tests/test_default_cluster_autoscaler_v2.py: 41 passed.pytest python/ray/data/tests/test_actor_autoscaler.py test_issue_detection_manager.py unit/test_deduping_schema.py test_rate_based_cluster_autoscaler.py test_resource_manager.py test_progress_manager.py test_map.py: no new failures vs master.pre-commit runon changed files: clean.Notes
gh pr list --repo ray-project/ray --state open --search "actor-only").🤖 Generated with Claude Code