Repository navigation
[data][actor-only][4/n] Actor-only backend: reject unsupported operators and options - #67700
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces topology validation for Ray Data's actor-only backend, preventing deadlocks by rejecting unsupported shuffle/all-to-all operators and execution options (such as preserve_order) early in the execution lifecycle. The feedback suggests optimizing this validation by running it before building the streaming topology and starting operators, which can be achieved by traversing the physical operator DAG using post_order_iter(). Additionally, adding an autouse fixture to the test suite is recommended to ensure the tests are self-contained and do not rely on external environment variables.
| if actor_only_backend_enabled(): | ||
| # Reject shuffle / all-to-all ops and unsupported options here, | ||
| # while the topology is still just a plan: the actor-only backend | ||
| # has no implementation for them and would otherwise stall midway. | ||
| from ray.data._internal.experimental.execution.topology_validation import ( | ||
| validate_actor_only_supported_topology, | ||
| ) | ||
|
|
||
| validate_actor_only_supported_topology(self._topology, self._options) | ||
|
|
There was a problem hiding this comment.
To avoid starting operators and allocating resources (which happens during build_streaming_topology when op.start() is called) for a topology that is destined to be rejected, we should perform this validation before building the topology.
Please move this validation block to run before build_streaming_topology (around line 318) and pass dag instead of self._topology.
# Validation moved before build_streaming_topology| def validate_actor_only_supported_topology( | ||
| topology: "Topology", options: ExecutionOptions | ||
| ) -> None: | ||
| """Reject configs / operators the actor-only backend cannot run. | ||
|
|
||
| Args: | ||
| topology: The built streaming topology, iterated for physical operators. | ||
| options: The execution options this run was configured with. | ||
|
|
||
| Raises: | ||
| ValueError: If ``preserve_order`` is set, or the topology contains an | ||
| operator the actor-only backend cannot execute. | ||
| """ | ||
| # Operators first: plans that require ordering (Zip, Sort) have | ||
| # ``preserve_order`` forced on by ``Dataset._execute``, so checking the | ||
| # option first would report "preserve_order" for an operator that is itself | ||
| # the unsupported thing, hiding the real reason. | ||
| for op in topology: | ||
| if isinstance(op, _UNSUPPORTED_ACTOR_ONLY_OPS): | ||
| raise ValueError( | ||
| f"{type(op).__name__} is not supported when actor only " | ||
| "backend is enabled" | ||
| ) | ||
| if options.preserve_order: | ||
| raise ValueError("preserve_order=True is not supported for actor only backend") |
There was a problem hiding this comment.
Update validate_actor_only_supported_topology to accept the root PhysicalOperator (dag) instead of the built Topology, and traverse it using dag.post_order_iter(). This allows us to validate the topology before starting any operators or allocating resources.
def validate_actor_only_supported_topology(
dag: PhysicalOperator,
options: ExecutionOptions,
) -> None:
"""Reject configs / operators the actor-only backend cannot run.
Args:
dag: The physical operator DAG, iterated for physical operators.
options: The execution options this run was configured with.
Raises:
ValueError: If ``preserve_order`` is set, or the topology contains an
operator the actor-only backend cannot execute.
"""
# Operators first: plans that require ordering (Zip, Sort) have
# ``preserve_order`` forced on by ``Dataset._execute``, so checking the
# option first would report "preserve_order" for an operator that is itself
# the unsupported thing, hiding the real reason.
for op in dag.post_order_iter():
if isinstance(op, _UNSUPPORTED_ACTOR_ONLY_OPS):
raise ValueError(
f"{type(op).__name__} is not supported when actor only "
"backend is enabled"
)
if options.preserve_order:
raise ValueError("preserve_order=True is not supported for actor only backend")5bd2234 to
55cde81
Compare
55cde81 to
9fc235a
Compare
9fc235a to
d9b6585
Compare
d9b6585 to
6e2df0c
Compare
rayhhome
left a comment
There was a problem hiding this comment.
Just one thing to double check:
6e2df0c to
c326192
Compare
|
We would also need to deny the Disk-based shuffle operators: #67700 (comment) |
c326192 to
42f89e1
Compare
7c8ee75 to
44c8bfe
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 44c8bfe. Configure here.
| GPUShuffleOperator, | ||
| DiskHashShuffleMapOp, | ||
| DiskHashShuffleReduceOp, | ||
| ) |
There was a problem hiding this comment.
TopN merge operator not rejected
Medium Severity
_UNSUPPORTED_ACTOR_ONLY_OPS omits TopNMergeOperator. When TopN rewrite is on under SHUFFLE_V2, sort().limit() becomes a local MapOperator plus TopNMergeOperator, which submits its own merge tasks via cached_remote_fn and is not an AllToAllOperator or shuffle op. That topology passes validation and can stall mid-run, which this check is meant to prevent.
Reviewed by Cursor Bugbot for commit 44c8bfe. Configure here.
|
premerge failing |
…ors and options The actor-only backend runs every operator on an actor pool, so the shuffle / all-to-all operators, which schedule their own tasks, have no implementation under it. Reject them once the topology is built rather than stalling partway through execution. `validate_actor_only_supported_topology` rejects AllToAllOperator, HashShuffleOperator, HashAggregateOperator, JoinOperator, ShuffleMapOp, ShuffleReduceOp and ZipOperator, plus `preserve_order=True`. `StreamingExecutor.execute` calls it right after `build_streaming_topology`, gated on `actor_only_backend_enabled()`, so the default path is untouched. Operators are checked before the `preserve_order` option on purpose: `Dataset._execute` forces `preserve_order=True` for plans that require ordering (Zip, Sort), so checking the option first reports "preserve_order" for an operator that is itself the unsupported thing and hides the real reason. The validation lives under `_internal/experimental/execution/` so the actor-only streaming executor can take it over when it lands; it is a free function rather than a method for that reason. Test: pytest python/ray/data/tests/actor_only (67 passed, including all 13 of test_disabled_configs.py). With the flag off, zip / sort / random_shuffle still execute normally. AI assistance was used for this change. 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]>
Signed-off-by: iamjustinhsu <[email protected]>
Signed-off-by: iamjustinhsu <[email protected]>
44c8bfe to
936c1f7
Compare
…r only backend (#67701) ## Summary Add `ExperimentalActorPoolMapOperator` and its actor pool, which the actor-only backend will use. It is kept separate from `ActorPoolMapOperator`, so the classic path barely changes. Nothing uses it until the next PR. Part 5 of 12 of the Ray Data actor-only backend stack. Stacked on #67700; review only the top commit. Everything here is gated behind `RAY_DATA_ACTOR_ONLY_BACKEND` (off by default) unless noted under **After**. ## Before Only the classic actor pool exists. It has no graceful drain, no per-actor input/output backpressure, and no way to scale up on a chosen node or scale down a chosen actor. ## After - The new pool and operator (not wired in yet) add: - graceful draining of actors that are running tasks; - `ResourceBank` integration; - per-actor input admission: a small task floor per slot, then an input-bytes cap; - output backpressure enforced while consuming each actor's stream, using core actor generator backpressure; - downscaling of specific actors and upscaling on specific nodes; - `num_cpus=1` when `num_gpus>0` and `num_cpus=0`. - **Shared code, all backends:** - pool accounting tells serving actors from draining ones; - `launch_task` / `TaskPullRequest` hooks for pull-based dispatch; - `generator_backpressure_disabled`; - Grafana panels for cross-node input transfer and actor draining; - `DataContext._actor_only_backend_override`, which lets internal datasets such as checkpoint loaders run on the classic backend. ```mermaid flowchart TD subgraph Before subgraph BS[Subsystem: execution] subgraph BC[Component: map operators] B1[ActorPoolMapOperator] --> B2[_ActorPool] end end end subgraph After subgraph AS[Subsystem: execution] subgraph AC[Component: map operators] A1[ActorPoolMapOperator] --> A2["_ActorPool (serving vs draining)"] A3[ExperimentalActorPoolMapOperator] --> A4["experimental ActorPool (drain, per-actor backpressure, targeted scaling)"] A1 -.subclass.-> A3 end end end class A3,A4 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:#000 ``` ## Subsystems execution (new operator, not wired yet), resource allocation / backpressure (per-actor admission and output backpressure), observability (dashboard panels) ## Testing Each run used a clean checkout of this branch. Any test that failed was rerun on unmodified `master` in 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`: 152 passed. - `pytest python/ray/data/tests/test_actor_autoscaler.py test_actor_pool_map_operator.py test_backlog_aware_actor_autoscaler.py test_node_aware_actor_pool.py unit/test_draining_actor_priority_bundle_queue.py test_map.py test_stats.py test_streaming_executor.py`: 536 passed, 20 failed. 19 fail identically on master. The 20th (`test_map.py::test_downstream_operators_scheduled_on_different_workers_than_read_workers`) passed 3 out of 3 reruns on this branch and on master, so it was a load flake. - `pre-commit run` on changed files: clean. ## Notes - Not a duplicate: no open ray-project/ray PR covers the actor-only backend (checked with `gh pr list --repo ray-project/ray --state open --search "actor-only"`). - AI assistance (Claude Code) was used for this change. I have reviewed every changed line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: iamjustinhsu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: sampan <[email protected]> Co-authored-by: Prasad Palkar <[email protected]>


Summary
Under the actor-only backend, reject topologies that contain all-to-all, shuffle, join or zip operators, or that set
preserve_order=True. These fail with a clear error as soon as the topology is built instead of stalling mid-run.Part 4 of 12 of the Ray Data actor-only backend stack. Stacked on #67699; review only the top commit. Everything here is gated behind
RAY_DATA_ACTOR_ONLY_BACKEND(off by default) unless noted under After.Before
Nothing stops an unsupported operator from running under the flag. It schedules its own tasks, which the actor-only backend can't account for.
After
With the flag on,
StreamingExecutor.executecallsvalidate_actor_only_supported_topologyright afterbuild_streaming_topology. Operators are checked beforepreserve_order, so Zip and Sort (which forcepreserve_order=True) report the operator as the cause. With the flag off, nothing changes.flowchart TD subgraph Before subgraph BS[Subsystem: execution] subgraph BC[Component: StreamingExecutor.execute] B1[build_streaming_topology] --> B2[run] end end end subgraph After subgraph AS[Subsystem: execution] subgraph AC[Component: StreamingExecutor.execute] A1[build_streaming_topology] --> A3["validate_actor_only_supported_topology (flag on)"] --> A2[run] end end end class A3 added classDef removed fill:#ffcdd2,stroke:#c62828,color:#000 classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 classDef changed fill:#fff9c4,stroke:#f9a825,color:#000Subsystems
execution (flag-gated)
Testing
RAY_DATA_ACTOR_ONLY_BACKEND=1 pytest python/ray/data/tests/actor_only: 67 passed, includingtest_topology_validation.py.pre-commit runon changed files: clean.Notes
gh pr list --repo ray-project/ray --state open --search "actor-only").🤖 Generated with Claude Code