ray.util.ActorPool.get_next#

ActorPool.get_next(timeout=None, ignore_if_timedout=False)[source]#

Returns the next pending result in order.

This returns the next result produced by submit(), blocking for up to the specified timeout until it is available.

Returns:

The next result.

Raises:

TimeoutError – if the timeout is reached.

Examples

import ray
from ray.util.actor_pool import ActorPool

@ray.remote
class Actor:
    def double(self, v):
        return 2 * v

a1, a2 = Actor.remote(), Actor.remote()
pool = ActorPool([a1, a2])
pool.submit(lambda a, v: a.double.remote(v), 1)
print(pool.get_next())
2