ray.util.ActorPool.pop_idle#
- ActorPool.pop_idle()[源代码]#
从池中移除一个空闲的演员。
- 返回:
如果有可用的空闲角色,则返回该角色。如果没有空闲角色可供移除,则返回 None。
示例
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) assert pool.pop_idle() is None assert pool.get_next() == 2 assert pool.pop_idle() == a1