[Core] support out of order execution for threaded/async actors
See original GitHub issueThe following will timeout
import ray
ray.init()
@ray.remote
class A:
def echo(self, inp):
print(inp)
return inp
@ray.remote
def never_return():
import time
time.sleep(10000)
inp_ref_1 = never_return.remote()
inp_ref_2 = ray.put(2)
a = A.options(max_concurrency=2).remote()
out_ref_1 = a.echo.remote(inp_ref_1)
out_ref_2 = a.echo.remote(inp_ref_2)
assert ray.get(out_ref_2, timeout=5) == 2 # currently timeout!
I went all the way back to Ray 0.8.0 and it is the same behavior, so this is not a regression. For concurrent actors and async actors, however, I think the snippet should work and we should allow later tasks to execute first when their dependencies ready. This is a semantics change.
Context: user bug report for Ray Serve https://discuss.ray.io/t/concurrent-queries-blocking-following-queries/3949/2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:13 (13 by maintainers)
Top Results From Across the Web
AsyncIO / Concurrency for Actors — Ray 2.2.0
Within a single actor process, it is possible to execute concurrent threads. Ray offers two types of concurrency within an actor: async execution....
Read more >Swift concurrency: Behind the scenes - WWDC NOTES
Reentrancy and prioritization · actors can execute items in an order that is not strictly first-in, first-out · actor new work items can...
Read more >Swift actors tutorial - a beginner's guide to thread safe ...
Learn how to use the brand new actor model to protect your application from unwanted data-races and memory issues.
Read more >Swift actors: How do they work, and what kinds of problems do ...
One of the core advantages of Swift's new actor types is that they can ... in serial order, regardless of which thread or...
Read more >Actors, the cooperative pool and concurrency - try Code
Running a single actor method · The cooperative thread pool that was mentioned in the WWDC videos is a concurrent dispatch queue called...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds good. I looked at this a bit more and I think we can potentially just enable it by default for concurrent/async actors, since the ordering was never really guaranteed for these in the first place.
Unfortunately the implementation may be quite tricky upon a deeper look. We might have to both change the client side dependency resolution logic, as well as the server queueing logic.
Maybe I can take this. it’s a forcing function for me to get a bit more familiar with this part of the code.