Multiple requests to a single Actor

Lets say i have an Actor class

class Blah:

   def method():
      .. processing .....

Then let say I call :


and then as the actor is still processing, I do a second call


will the call be blocked until the processing of the first finished.

Because the Actor is a single process.

The second one will be queued until the first one is finished. But it’s async and in your script, unless you call ray.get(), it won’t block your program.

did u mean :

But if your script is using async , unless you call ray.get(), it won’t block your program.

i.e. .remote() wont wait ?

I believe you can give the following script a try:

import ray
import time
class Actor:
    def func(self):

a = Actor.remote()

obj1 = a.func.remote()
obj2 = a.func.remote()

print("CALLED", time.perf_counter())
ray.get([obj1, obj2])
print("FINISHED", time.perf_counter())

And it’ll output:

CALLED 3334824.667657991
FINISHED 3334845.113125455

No, I mean the function is async by default, until you call wait/get

1 Like

Ooo i see … every call takes 10 secs on the remote end …and second one is processed after the first finishes… but you get the result after you call .get() i.e. current process is blocked for 20 sec

of course if you dont call .get() it has no impact on the current process …

I just wanted to be reassured that the remote Actor acts as a single process i.e. every next request is processed sequentially … one after the other


Yes, it’s a single process and we have code to ensure they are executed one by one