ray.util.ActorPool.has_free#
- ActorPool.has_free()[source]#
Returns whether there are any idle actors available.
- Returns:
True if there are any idle actors and no pending submits.
Examples
import ray from ray.util.actor_pool import ActorPool @ray.remote class Actor: def double(self, v): return 2 * v a1 = Actor.remote() pool = ActorPool([a1]) pool.submit(lambda a, v: a.double.remote(v), 1) print(pool.has_free()) print(pool.get_next()) print(pool.has_free())
False 2 True