ray.util.ActorPool.has_next#

ActorPool.has_next()[source]#

Returns whether there are any pending results to return.

Returns:

True if there are any pending results not yet returned.

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.has_next())
print(pool.get_next())
print(pool.has_next())
True
2
False