Feature request about `acor.wait()` API

1. Problems And Background

Many users’ code needs a function that waits for an actor to complete. Previously, we were encouraging users to implement meaningless remote calls such as ray.wait (actor.no_op.remote()) to workaround. But as the scale of the user code repository grows, so does the cost of maintenance.

Therefore, I’d like to propose an API that waits for an actor to be created successfully, to simplify such operations for users.

2. API

python

actor.wait(timeout_ms=500)
actor.wait()  # timout_ms is infinite

Java

actor.wait(500, TimeUnit.MilliSeconds);
actor.wait();  // timeoutMs is infinite

Exceptions such as TimeoutException, ActorDeadException would be thrown if the actor is not created successfully.

PS:
We have no need to implement ray.wait(actor_list) API currently. If we have the needs of ray.wait(actor_list) API in the future, it’s easy to wrap by:

def wait(actor_list):
    for actor in actor_list:
        actor.wait()

Can you create a Github issue with RFC label? We need to core API change approval for this type of API updates.

1 Like