forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Streaming Generator] Make it compatible with wait (ray-project#36071)
This PR makes the streaming generator compatible with ray.wait. The semantic is as follows; def f(): for _ in range(3): yield 1 generator = f.options(num_returns="streaming").remote() # The generator will be in ready if the next reference is available. Otherwise it is in unready. # This should work with all other options from ray.wait (including fetch_local=True/False) ready, unready = ray.wait([generator]) # if the generator's next ref is not ready in 0.1 second, it will be in unready. # otherwise, it is in ready ready, unready = ray.wait([generator], timeout=0.1) # If the generator's next ref is available, it is considered as 1 return # In this case, this will return if both generator and ref is ready. ready, unready = ray.wait([generator, ref], num_returns=2) # if the generator's next ref is available, it will fetch the object to the local node ready, unready = ray.wait([generator, ref], fetch_local=True) From the previous PR ray-project#36070, we are now able to peek the object reference, and the peeked object is guaranteed to be resolved. We can always peek the next object from the generator and wait on that reference to make the generator compatible to ray.wait. Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
- Loading branch information
1 parent
87e1ef0
commit 939d1d2
Showing
4 changed files
with
310 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.