Repository navigation
[data][actor-only][10/n] AO cleanup aftermath - #67706
iamjustinhsu wants to merge 3 commits into
Conversation
fbdf128 to
c6dbcdc
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements to Ray Data's execution sizer, including a warmup timeout mechanism, a thrashing prevention window for capacity transfers, and improved actor backpressure metrics that exclude draining or restarting actors. It also refactors capacity transfers to hold owed capacity until donor slots are freed and resolves a concurrency issue during executor shutdown. However, the reviewer identified a regression in the operator ordering logic: defaulting num_schedulable_nodes to 0 instead of None incorrectly prioritizes operators with unknown eligibility over highly constrained ones. To preserve the 'scarcity first' principle, it is recommended to revert this field to Optional[int], update the sorting key to handle None as infinite, and restore the corresponding test cases.
c6dbcdc to
14597c2
Compare
40fa403 to
f406bfa
Compare
909a569 to
bc4d1ed
Compare
2292e20 to
5819607
Compare
5819607 to
b7de3b7
Compare
b7de3b7 to
b199a6e
Compare
a2fbf79 to
6339405
Compare
| # of closing is thrashing the same capacity back and forth. | ||
| recent_transfers: Deque[RecentTransfer] = field( | ||
| default_factory=lambda: deque(maxlen=8) | ||
| ) |
There was a problem hiding this comment.
Thrash window dropped after eight transfers
Low Severity
inverted_by is supposed to refuse an inverse transfer for THRASH_WINDOW_S after close, but recent_transfers is still a deque(maxlen=8). A ninth transfer evicts an earlier record even if it closed inside the window, so A→B then B→A can proceed before the configured ticks have elapsed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6339405. Configure here.
6339405 to
8390ae8
Compare
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 8390ae8. Configure here.
| """ | ||
| self._record_transfer_pendings(state) | ||
| self._close_finished_transfers(ctx, state) | ||
| self._hold_owed_capacity(ctx, state) |
There was a problem hiding this comment.
Timeout preempts same-tick placement
Medium Severity
advance closes timed-out transfers before _hold_owed_capacity can place on newly freed slots. A donor that finishes draining after SIZER_TRANSFER_TIMEOUT_S loses the transfer on the tick the recipient could finally be brought up, and the hold is dropped so another operator can take that capacity.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 8390ae8. Configure here.
There was a problem hiding this comment.
Nit and not blocking: I guess this could be an improvement, but only for the rare case when a donor finishes draining on the tick the 60s timer runs out. One way of addressing this is to split the timeout check out of _close_finished_transfers and move it below this line _hold_owned_capacity.
8390ae8 to
349796c
Compare
349796c to
51a8e42
Compare
b5f7508 to
9bda5ab
Compare
Sizer follow-ups: - Open capacity transfers hold the capacity they're still owed against free capacity, so another op can't take it before the recipient scales up. - A transfer that would undo a recent one is refused as thrashing for RAY_DATA_SIZER_TRANSFER_THRASH_WINDOW_TICKS ticks (default 20). - Warmup ends after at most RAY_DATA_SIZER_WARMUP_TIMEOUT_S (default 300s) even if a critical op never produces output. - Initial-sizing order: below-min ops go first, but the scarcity tiers (label, placement group, GPU) still apply within that group, so constrained ops are placed before unconstrained ones at startup. - heterogeneous_memory_batch_inference requests num_cpus=1 for its GPU stage, and the GPU nodes in its compute configs (single-tenant and multitenancy) get CPUs. 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]>
9bda5ab to
155d334
Compare
rayhhome
left a comment
There was a problem hiding this comment.
Approved with a few non-blocking comments!
| else: | ||
| pool._release_running_actor(actor) | ||
| assert pool.get_resource_requests() == [] | ||
| def test_output_backpressured_actors_counts_serving_actors_only(): |
There was a problem hiding this comment.
This is failing pre_commit and needs two blank lines before it.
| """ | ||
| self._record_transfer_pendings(state) | ||
| self._close_finished_transfers(ctx, state) | ||
| self._hold_owed_capacity(ctx, state) |
There was a problem hiding this comment.
Nit and not blocking: I guess this could be an improvement, but only for the rare case when a donor finishes draining on the tick the 60s timer runs out. One way of addressing this is to split the timeout check out of _close_finished_transfers and move it below this line _hold_owned_capacity.
| # The GPU nodes have CPUs for the GPU stage's actors; keep the CPU stages | ||
| # on the small-memory CPU nodes this test is about. Merged with the | ||
| # tenant's subcluster selector, if any. | ||
| cpu_nodes = {"node-pool": "cpu"} |
There was a problem hiding this comment.
Should we add this selector to the random_shuffle above (line 129)? I think it aligns with the purpose of this test by preventing unlabelled CPU work landing on the GPU nodes.
…cleanup-aftermath Signed-off-by: iamjustinhsu <[email protected]>
…cleanup-aftermath Signed-off-by: iamjustinhsu <[email protected]>


Summary
Follow-ups on the sizer:
Part 10 of 12 of the Ray Data actor-only backend stack. Stacked on #67705; review only the top commit. Everything here is gated behind
RAY_DATA_ACTOR_ONLY_BACKEND(off by default) unless noted under After.Before
A capacity transfer's freed capacity can be taken by another operator before its recipient scales up. A transfer can be undone right away (A->B, then B->A). If one critical operator never produces output, the sizer stays in warmup indefinitely.
After
free.RAY_DATA_SIZER_TRANSFER_THRASH_WINDOW_TICKSticks (default 20).RAY_DATA_SIZER_WARMUP_TIMEOUT_S(default 300s).heterogeneous_memory_batch_inferencenow requestsnum_cpus=1for its GPU stage. The GPU nodes in both compute configs that run it (heterogeneous_memory_compute.yamlandheterogeneous_memory_compute_multitenancy.yaml, which reuses the same pipeline) now have CPUs.flowchart TD subgraph Before subgraph BS[Subsystem: resource allocation] subgraph BC[Component: sizer optimizer] B1[capacity transfer] --> B2[free capacity up for grabs] end end end subgraph After subgraph AS[Subsystem: resource allocation] subgraph AC[Component: sizer optimizer] A1[capacity transfer] --> A2[hold owed capacity] A1 --> A3[refuse inverse transfer within thrash window] A4[warmup timeout] end end end class A2,A3,A4 added class A1 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
resource allocation / autoscaling (flag-gated); release test config
Testing
RAY_DATA_ACTOR_ONLY_BACKEND=1 pytest python/ray/data/tests/actor_only: 368 passed, including the newtest_scarcity_first_ordering[all-below-min-keeps-tiers]case.pre-commit runon changed files: clean.Notes
gh pr list --repo ray-project/ray --state open --search "actor-only").🤖 Generated with Claude Code