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","]"]
code: def __init__(self, actors: list):
      from ray._private.usage.usage_lib import record_library_usage
  
      record_library_usage("util.ActorPool")
  
      # actors to be used
      self._idle_actors = list(actors)
  
      # get actor from future
      self._future_to_actor = {}
  
      # get future from index
      self._index_to_future = {}
  
      # next task to do
      self._next_task_index = 0
  
      # next task to return
      self._next_return_index = 0
  
      # next work depending when actors free
      self._pending_submits = []
  
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 1 to create a new ActorPool object  with example: obj = ActorPool(actors)