class_docstr: Utility class to operate on a fixed pool of actors.
  
  Arguments:
      actors: List of Ray actor handles to use in this pool.
  
  Examples:
      .. testcode::
  
          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])
          print(list(pool.map(lambda a, v: a.double.remote(v),
                              [1, 2, 3, 4])))
  
      .. testoutput::
  
          [2, 4, 6, 8]
class_docstr_tok: ["Utility","class","to","operate","on","a","fixed","pool","of","actors",".","Arguments",":","actors",":","List","of","Ray","actor","handles","to","use","in","this","pool",".","Examples",":","..","testcode",":",":","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","]",")","print","(","list","(","pool.map","(","lambda","a",",","v",":","a.double.remote","(","v",")",",","[","1",",","2",",","3",",","4","]",")",")",")","..","testoutput",":",":","[","2",",","4",",","6",",","8","]"]
docstr: Pushes a new actor into the current list of idle actors.
  
  Examples:
      .. testcode::
  
          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])
          pool.push(a2)
docstr_tok: ["Pushes","a","new","actor","into","the","current","list","of","idle","actors",".","Examples",":","..","testcode",":",":","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","]",")","pool.push","(","a2",")"]
code: def push(self, actor):
      """Pushes a new actor into the current list of idle actors.
  
      Examples:
          .. testcode::
  
              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])
              pool.push(a2)
      """
      busy_actors = []
      if self._future_to_actor.values():
          _, busy_actors = zip(*self._future_to_actor.values())
      if actor in self._idle_actors or actor in busy_actors:
          raise ValueError("Actor already belongs to current ActorPool")
      else:
          self._return_actor(actor)
  
file_path: ray/python/ray/util/actor_pool.py
imports: from typing import TYPE_CHECKING, Any, Callable, List, TypeVar
  import ray
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 11 for calling the ActorPool obj's underlying member method code with example usage: obj.push(actor) without return types