Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements support for consume_once on streaming generator actor methods in Ray. Previously, _consume_once=True was not supported for streaming generators. With these changes, each object yielded by a streaming generator with consume_once enabled is created as MOVABLE (allowing it to be moved to the consumer's node and freed from the producer's node), while the generator object itself remains NOT_MOVABLE. The implementation updates the C++ ReferenceCounter and TaskManager to track and propagate the yields_consume_once property, and adds comprehensive unit and integration tests in both Python and C++ to verify the behavior. There are no review comments to address, so no further feedback is provided.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 063560a. Configure here.
063560a to
700eaa8
Compare
700eaa8 to
1245c19
Compare
1245c19 to
1bb2992
Compare
1bb2992 to
2e9f91e
Compare
…ble objects Signed-off-by: kartica.modi <kartica.modi@anyscale.com>
2e9f91e to
62e98dc
Compare

This is PR 8 of a series of PRs to implement move semantics for plasma objects in core.
The complete design doc is here: https://docs.google.com/document/d/1ZJhgRmwVyKfNCR21CWf6xMcc0B6HJwSPQsfebTRvnnE/edit?tab=t.0#heading=h.7wcod1f9afpg
Until now
_consume_once=Truewas rejected on streaming generator actor methods (#66620). With this PR it is accepted, and every object the generator yields can be moved to exactly one consumer, the same way a plain return can.Changes
AddPendingTaskdoesn't make the generator objectMOVABLE. Instead it sets a newReferencefield,yields_consume_once_, on it when a streaming generator object is created with_consume_oncemethod option, through a newAddOwnedObjectparameter. The generator object itself staysNOT_MOVABLE.MOVABLE.OwnDynamicStreamingTaskReturnRefpassesMOVABLEas the initial move state when the generator object has the flag. Every creation path goes through it.ActorMethod._remoteno longer rejects streaming generator methods.Nothing else changes for the generated object refs. Everything in the previous PRs apply to it.
Every yield of the generator becomes consume-once, including small ones kept in the owner's memory store.
A generator that runs again, after an actor restart or for lineage reconstruction, reports every item again, and the owner records the new run's node as each item's primary. For an item that was already moved, the consumer's node keeps its copy too, so the item has two copies until it goes out of scope. Master does the same today with the old copy of any item a generator reports again, so this PR doesn't change it.