class_docstr: Group of Ray Actors that can execute arbitrary functions.
  
  ``ActorGroup`` launches Ray actors according to the given
  specification. It can then execute arbitrary Python functions in each of
  these actors.
  
  If not enough resources are available to launch the actors, the Ray
  cluster will automatically scale up if autoscaling is enabled.
  
  Args:
      actor_cls: The class to use as the remote actors.
      num_actors: The number of the provided Ray actors to
          launch. Defaults to 1.
      num_cpus_per_actor: The number of CPUs to reserve for each
          actor. Fractional values are allowed. Defaults to 1.
      num_gpus_per_actor: The number of GPUs to reserve for each
          actor. Fractional values are allowed. Defaults to 0.
      resources_per_actor (Optional[Dict[str, float]]):
          Dictionary specifying the resources that will be
          requested for each actor in addition to ``num_cpus_per_actor``
          and ``num_gpus_per_actor``.
      init_args, init_kwargs: If ``actor_cls`` is provided,
          these args will be used for the actor initialization.
class_docstr_tok: ["Group","of","Ray","Actors","that","can","execute","arbitrary","functions",".","``","ActorGroup","``","launches","Ray","actors","according","to","the","given","specification",".","It","can","then","execute","arbitrary","Python","functions","in","each","of","these","actors",".","If","not","enough","resources","are","available","to","launch","the","actors",",","the","Ray","cluster","will","automatically","scale","up","if","autoscaling","is","enabled",".","Args",":","actor_cls",":","The","class","to","use","as","the","remote","actors",".","num_actors",":","The","number","of","the","provided","Ray","actors","to","launch",".","Defaults","to","1.","num_cpus_per_actor",":","The","number","of","CPUs","to","reserve","for","each","actor",".","Fractional","values","are","allowed",".","Defaults","to","1.","num_gpus_per_actor",":","The","number","of","GPUs","to","reserve","for","each","actor",".","Fractional","values","are","allowed",".","Defaults","to","0.","resources_per_actor","(","Optional","[","Dict","[","str",",","float","]","]",")",":","Dictionary","specifying","the","resources","that","will","be","requested","for","each","actor","in","addition","to","``","num_cpus_per_actor","``","and","``","num_gpus_per_actor","``",".","init_args",",","init_kwargs",":","If","``","actor_cls","``","is","provided",",","these","args","will","be","used","for","the","actor","initialization","."]
docstr: Shutdown all the actors in this actor group.
  
  Args:
      patience_s: Attempt a graceful shutdown
          of the actors for this many seconds. Fallback to force kill
          if graceful shutdown is not complete after this time. If
          this is less than or equal to 0, immediately force kill all
          actors.
docstr_tok: ["Shutdown","all","the","actors","in","this","actor","group",".","Args",":","patience_s",":","Attempt","a","graceful","shutdown","of","the","actors","for","this","many","seconds",".","Fallback","to","force","kill","if","graceful","shutdown","is","not","complete","after","this","time",".","If","this","is","less","than","or","equal","to","0",",","immediately","force","kill","all","actors","."]
code: def shutdown(self, patience_s: float = 5):
      """Shutdown all the actors in this actor group.
  
      Args:
          patience_s: Attempt a graceful shutdown
              of the actors for this many seconds. Fallback to force kill
              if graceful shutdown is not complete after this time. If
              this is less than or equal to 0, immediately force kill all
              actors.
      """
      logger.debug(f"Shutting down {len(self.actors)} actors.")
      if patience_s <= 0:
          for actor in self.actors:
              ray.kill(actor.actor)
      else:
          done_refs = [
              w.actor.__ray_terminate__.remote() for w in self.actors
          ]
          # Wait for actors to die gracefully.
          done, not_done = ray.wait(done_refs, timeout=patience_s)
          if not_done:
              logger.debug(
                  "Graceful termination failed. Falling back to force kill."
              )
              # If all actors are not able to die gracefully, then kill them.
              for actor in self.actors:
                  ray.kill(actor.actor)
  
      logger.debug("Shutdown successful.")
      self.actors = []
  
imports: import weakref
  from dataclasses import dataclass
  import logging
  from typing import List, TypeVar, Optional, Dict, Type, Tuple
  import ray
  from ray.actor import ActorHandle
  from ray.util.annotations import Deprecated
  from ray._private.utils import get_ray_doc_version
label_desc: Use image node_id 6 for calling the ActorGroup obj's underlying member method code with example usage: obj.shutdown(patience_s) without return types