Repository navigation
[data][actor-only][5/n] Experimental actor pool map operator for actor only backend - #67701
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the actor-only backend for Ray Data, implementing an experimental actor pool and map operator that support pull-based dispatch, per-actor input/output budgets, and spot-preemption node draining. Key feedback includes importing the missing Any type in actor_pool.py, adding defensive defaults to prevent TypeError when optional ExecutionResources fields (such as cpu and object_store_memory) are None, and gracefully handling None values for actor_id in actor_pool_map_operator.py to avoid executor crashes.
33454e6 to
d771820
Compare
2c9cd3a to
1c8ee5c
Compare
86d6139 to
e734a10
Compare
e734a10 to
c898783
Compare
| exception or task_exec_driver_stats | ||
| ), "Driver's task execution stats must be provided on task's successful completion" | ||
|
|
||
| inputs = self._metrics._running_tasks[task_index].inputs |
There was a problem hiding this comment.
I think we don't need this line here because we already have inputs's value in the closure at this point and the value is the same.
| MIN_ACTORS_LOG_INTERVAL_S: float = 30.0 | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| self._user_set_ray_remote_args: Dict[str, Any] = dict( |
There was a problem hiding this comment.
Here, self._user_set_ray_remote_args and self._user_set_ray_remote_args_fn are read with kwargs.get, which assumes callers pass them by keyword. But in ActorPoolMapOperator, the constructor declares them as ordinary parameters, so they can also be passed by position:
class ActorPoolMapOperator(MapOperator, ReportsExtraResourceUsage):
...
def __init__(
self,
...,
ray_remote_args_fn: Optional[Callable[[], Dict[str, Any]]] = None,
ray_remote_args: Optional[Dict[str, Any]] = None,
...
):
...This means if a future caller passes them by position, they will land in *args. ExperimentalActorPoolMapOperator's local copy will misalign with what its superclass (ActorPoolMapOperator) owns. Everything is wired correctly today, but it might be better to make this explicit so it's foolproof.
c898783 to
123b8cb
Compare
| parts.append(f"blocked={blocked}/{self.actor_pool.current_size()}") | ||
| if not parts: | ||
| return "" | ||
| return f"[{', '.join(parts)}]" |
There was a problem hiding this comment.
Progress bar uses wrong actor count
Low Severity
backpressure_progress_str reports blocked over current_size(), but cached_output_backpressured_actors already returns (blocked, running). current_size includes pending and draining actors, so the fraction does not match the share of serving actors that cannot emit, which is what the docstring describes.
Reviewed by Cursor Bugbot for commit 123b8cb. Configure here.
There was a problem hiding this comment.
This would result in underreporting from [10/n] on and should be quite easy to fix. Not blocking though.
94a6edc to
a11697e
Compare
rayhhome
left a comment
There was a problem hiding this comment.
LGTM! Cursor's reports are non-blocking but are probably worth fixing.
| parts.append(f"blocked={blocked}/{self.actor_pool.current_size()}") | ||
| if not parts: | ||
| return "" | ||
| return f"[{', '.join(parts)}]" |
There was a problem hiding this comment.
This would result in underreporting from [10/n] on and should be quite easy to fix. Not blocking though.
a11697e to
8308eae
Compare
| continue | ||
| if not self._actor_pull_budget(actor_id).all_fields_gt(zeros): | ||
| blocked += 1 | ||
| result = (blocked, info.running) |
There was a problem hiding this comment.
Draining actors inflate backpressure counts
Medium Severity
output_backpressured_actors walks get_logical_ids() and counts any actor has_actor still knows about, including draining ones, but reports the denominator as info.running, which excludes draining actors. Draining actors usually sit at an exhausted pull budget, so blocked can exceed running. backpressure_progress_str then ignores that running count and divides by current_size, and it also drops the base class's task-submission backpressure tag. Idle detection and the sizer that refresh this cache will treat a draining pool as fully output-blocked.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8308eae. Configure here.
| cpu=self._ray_remote_args.get("num_cpus"), | ||
| gpu=self._ray_remote_args.get("num_gpus"), | ||
| memory=self._ray_remote_args.get("memory"), | ||
| ) |
There was a problem hiding this comment.
GPU actors get tiny output budgets
Medium Severity
_apply_default_remote_args never rewrites num_cpus=0 to 1 when num_gpus>0, and _create_actor_pool_config records cpu from ray_remote_args as-is. Pool output-budget derivation then sees zero CPU, takes the zero-CPU branch, and clamps to the 16MiB floor. GPU map_batches that omit num_cpus (Ray Core still launches them with 1 CPU) therefore run under a far smaller per-actor object-store cap than their real footprint, so generator backpressure will stall GPU actors almost immediately.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8308eae. Configure here.
8308eae to
2c41511
Compare
| f"max_input_bytes_per_actor={self.max_input_bytes_per_actor}, " | ||
| f"max_concurrent_calls_per_actor={self.max_concurrent_calls_per_actor}, " | ||
| f"max_num_output_bytes_per_actor={self.max_num_output_bytes_per_actor}, " | ||
| f"max_num_outputs_per_actor={self.max_num_outputs_per_actor}, " |
There was a problem hiding this comment.
Duplicated strategy equality and repr fields
Low Severity
While removing max_input_bytes_per_actor, ActorPoolStrategy.__eq__ and __repr__ still compare and print max_num_output_bytes_per_actor and max_num_outputs_per_actor twice. Equality is unchanged, but __repr__ now emits duplicate fields, which makes logs and debug output misleading and invites later drift if only one copy is updated.
Reviewed by Cursor Bugbot for commit 2c41511. Configure here.
2c41511 to
8308eae
Compare
…r only backend Adds experimental actor pool and actor pool map operator which will be used when the actor only backend is enabled. We are deliberately keeping this separate so that when the flag is off the existing path is minimally affected. the new actor pool supports: - gracefully draining of actors running tasks - integration with the resource bank API's - support for actor level backpressure - uses core actor backpressure (`_actor_generator_backpressure_num_objects`) - input admission: each actor always admits a small task floor (max_concurrency x RAY_DATA_PER_ACTOR_INPUT_BACKPRESSURE_MIN_NUM_TASKS, default 2/slot); beyond the floor, a per-actor input-bytes cap owns admission. Setting max_tasks_in_flight_per_actor raises NotImplementedError under this backend. - dynamically setting output bp for actors and enforcing it during object consumption from streams - down scaling specific actors - upscaling actors on specific nodes - sets num cpu = 1 when num_gpu > 0 and num_cpu=0. Not currently used, will be used by subsequent pr's 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]>
8308eae to
08502e8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
❌ 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 08502e8. Configure here.
| # pool; the actor-denominated pair reads blocked < running there and | ||
| # would disable the hatch at exactly the state it exists for. | ||
| blocked, active = self.output_backpressured_fraction() | ||
| return blocked == active |
There was a problem hiding this comment.
Vacuous output backpressure detection
Medium Severity
is_output_backpressured returns true when every in-flight task is skipped as an orphan (blocked == active == 0). A released actor can leave tasks in _data_tasks that output_backpressured_fraction does not count, so the deadlock hatch can fire even though no live task is blocked on output budget.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 08502e8. Configure here.


Summary
Add
ExperimentalActorPoolMapOperatorand its actor pool, which the actor-only backend will use. It is kept separate fromActorPoolMapOperator, 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
ResourceBankintegration;num_cpus=1whennum_gpus>0andnum_cpus=0.launch_task/TaskPullRequesthooks for pull-based dispatch;generator_backpressure_disabled;DataContext._actor_only_backend_override, which lets internal datasets such as checkpoint loaders run on the classic backend.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:#000Subsystems
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
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: 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 runon changed files: clean.Notes
gh pr list --repo ray-project/ray --state open --search "actor-only").🤖 Generated with Claude Code