class_docstr: An actor class.
  
  This is a decorated class. It can be used to create actors.
  
  Attributes:
      __ray_metadata__: Contains metadata for the actor.
class_docstr_tok: ["An","actor","class",".","This","is","a","decorated","class",".","It","can","be","used","to","create","actors",".","Attributes",":","__ray_metadata__",":","Contains","metadata","for","the","actor","."]
docstr: Configures and overrides the actor instantiation parameters.
  
  The arguments are the same as those that can be passed
  to :obj:`ray.remote`.
  
  Args:
      num_cpus: The quantity of CPU cores to reserve
          for this task or for the lifetime of the actor.
      num_gpus: The quantity of GPUs to reserve
          for this task or for the lifetime of the actor.
      resources (Dict[str, float]): The quantity of various custom resources
          to reserve for this task or for the lifetime of the actor.
          This is a dictionary mapping strings (resource names) to floats.
      accelerator_type: If specified, requires that the task or actor run
          on a node with the specified type of accelerator.
          See :ref:`accelerator types <accelerator_types>`.
      memory: The heap memory request in bytes for this task/actor,
          rounded down to the nearest integer.
      object_store_memory: The object store memory request for actors only.
      max_restarts: This specifies the maximum
          number of times that the actor should be restarted when it dies
          unexpectedly. The minimum valid value is 0 (default),
          which indicates that the actor doesn't need to be restarted.
          A value of -1 indicates that an actor should be restarted
          indefinitely.
      max_task_retries: How many times to
          retry an actor task if the task fails due to a system error,
          e.g., the actor has died. If set to -1, the system will
          retry the failed task until the task succeeds, or the actor
          has reached its max_restarts limit. If set to `n > 0`, the
          system will retry the failed task up to n times, after which the
          task will throw a `RayActorError` exception upon :obj:`ray.get`.
          Note that Python exceptions are not considered system errors
          and don't trigger retries. [Internal use: You can override this number
          with the method's "_max_retries" option at @ray.method decorator or
          at .option() time.]
      max_pending_calls: Set the max number of pending calls
          allowed on the actor handle. When this value is exceeded,
          PendingCallsLimitExceeded will be raised for further tasks.
          Note that this limit is counted per handle. -1 means that the
          number of pending calls is unlimited.
      max_concurrency: The max number of concurrent calls to allow for
          this actor. This only works with direct actor calls. The max
          concurrency defaults to 1 for threaded execution, and 1000 for
          asyncio execution. Note that the execution order is not
          guaranteed when max_concurrency > 1.
      name: The globally unique name for the actor, which can be used
          to retrieve the actor via ray.get_actor(name) as long as the
          actor is still alive.
      namespace: Override the namespace to use for the actor. By default,
          actors are created in an anonymous namespace. The actor can
          be retrieved via ray.get_actor(name=name, namespace=namespace).
      lifetime: Either `None`, which defaults to the actor will fate
          share with its creator and will be deleted once its refcount
          drops to zero, or "detached", which means the actor will live
          as a global object independent of the creator.
      runtime_env (Dict[str, Any]): Specifies the runtime environment for
          this actor or task and its children. See
          :ref:`runtime-environments` for detailed documentation.
      scheduling_strategy: Strategy about how to
          schedule a remote function or actor. Possible values are
          None: ray will figure out the scheduling strategy to use, it
          will either be the PlacementGroupSchedulingStrategy using parent's
          placement group if parent has one and has
          placement_group_capture_child_tasks set to true,
          or "DEFAULT";
          "DEFAULT": default hybrid scheduling;
          "SPREAD": best effort spread scheduling;
          `PlacementGroupSchedulingStrategy`:
          placement group based scheduling;
          `NodeAffinitySchedulingStrategy`:
          node id based affinity scheduling.
      _metadata: Extended options for Ray libraries. For example,
          _metadata={"workflows.io/options": <workflow options>} for
          Ray workflows.
  
  Examples:
  
  .. code-block:: python
  
      @ray.remote(num_cpus=2, resources={"CustomResource": 1})
      class Foo:
          def method(self):
              return 1
      # Class Bar will require 1 cpu instead of 2.
      # It will also require no custom resources.
      Bar = Foo.options(num_cpus=1, resources=None)
docstr_tok: ["Configures","and","overrides","the","actor","instantiation","parameters",".","The","arguments","are","the","same","as","those","that","can","be","passed","to",":","obj",":","`","ray.remote","`",".","Args",":","num_cpus",":","The","quantity","of","CPU","cores","to","reserve","for","this","task","or","for","the","lifetime","of","the","actor",".","num_gpus",":","The","quantity","of","GPUs","to","reserve","for","this","task","or","for","the","lifetime","of","the","actor",".","resources","(","Dict","[","str",",","float","]",")",":","The","quantity","of","various","custom","resources","to","reserve","for","this","task","or","for","the","lifetime","of","the","actor",".","This","is","a","dictionary","mapping","strings","(","resource","names",")","to","floats",".","accelerator_type",":","If","specified",",","requires","that","the","task","or","actor","run","on","a","node","with","the","specified","type","of","accelerator",".","See",":","ref",":","`","accelerator","types","<","accelerator_types",">","`",".","memory",":","The","heap","memory","request","in","bytes","for","this","task\/actor",",","rounded","down","to","the","nearest","integer",".","object_store_memory",":","The","object","store","memory","request","for","actors","only",".","max_restarts",":","This","specifies","the","maximum","number","of","times","that","the","actor","should","be","restarted","when","it","dies","unexpectedly",".","The","minimum","valid","value","is","0","(","default",")",",","which","indicates","that","the","actor","does","n't","need","to","be","restarted",".","A","value","of","-1","indicates","that","an","actor","should","be","restarted","indefinitely",".","max_task_retries",":","How","many","times","to","retry","an","actor","task","if","the","task","fails","due","to","a","system","error",",","e.g.",",","the","actor","has","died",".","If","set","to","-1",",","the","system","will","retry","the","failed","task","until","the","task","succeeds",",","or","the","actor","has","reached","its","max_restarts","limit",".","If","set","to","`","n",">","0","`",",","the","system","will","retry","the","failed","task","up","to","n","times",",","after","which","the","task","will","throw","a","`","RayActorError","`","exception","upon",":","obj",":","`","ray.get","`",".","Note","that","Python","exceptions","are","not","considered","system","errors","and","do","n't","trigger","retries",".","[","Internal","use",":","You","can","override","this","number","with","the","method","'s","``","_max_retries","''","option","at","@","ray.method","decorator","or","at",".option","(",")","time",".","]","max_pending_calls",":","Set","the","max","number","of","pending","calls","allowed","on","the","actor","handle",".","When","this","value","is","exceeded",",","PendingCallsLimitExceeded","will","be","raised","for","further","tasks",".","Note","that","this","limit","is","counted","per","handle",".","-1","means","that","the","number","of","pending","calls","is","unlimited",".","max_concurrency",":","The","max","number","of","concurrent","calls","to","allow","for","this","actor",".","This","only","works","with","direct","actor","calls",".","The","max","concurrency","defaults","to","1","for","threaded","execution",",","and","1000","for","asyncio","execution",".","Note","that","the","execution","order","is","not","guaranteed","when","max_concurrency",">","1.","name",":","The","globally","unique","name","for","the","actor",",","which","can","be","used","to","retrieve","the","actor","via","ray.get_actor","(","name",")","as","long","as","the","actor","is","still","alive",".","namespace",":","Override","the","namespace","to","use","for","the","actor",".","By","default",",","actors","are","created","in","an","anonymous","namespace",".","The","actor","can","be","retrieved","via","ray.get_actor","(","name=name",",","namespace=namespace",")",".","lifetime",":","Either","`","None","`",",","which","defaults","to","the","actor","will","fate","share","with","its","creator","and","will","be","deleted","once","its","refcount","drops","to","zero",",","or","``","detached","''",",","which","means","the","actor","will","live","as","a","global","object","independent","of","the","creator",".","runtime_env","(","Dict","[","str",",","Any","]",")",":","Specifies","the","runtime","environment","for","this","actor","or","task","and","its","children",".","See",":","ref",":","`","runtime-environments","`","for","detailed","documentation",".","scheduling_strategy",":","Strategy","about","how","to","schedule","a","remote","function","or","actor",".","Possible","values","are","None",":","ray","will","figure","out","the","scheduling","strategy","to","use",",","it","will","either","be","the","PlacementGroupSchedulingStrategy","using","parent's","placement","group","if","parent","has","one","and","has","placement_group_capture_child_tasks","set","to","true",",","or","``","DEFAULT","''",";","``","DEFAULT","''",":","default","hybrid","scheduling",";","``","SPREAD","''",":","best","effort","spread","scheduling",";","`","PlacementGroupSchedulingStrategy","`",":","placement","group","based","scheduling",";","`","NodeAffinitySchedulingStrategy","`",":","node","id","based","affinity","scheduling",".","_metadata",":","Extended","options","for","Ray","libraries",".","For","example",",","_metadata=","{","``","workflows.io\/options","''",":","<","workflow","options",">","}","for","Ray","workflows",".","Examples",":","..","code-block",":",":","python","@","ray.remote","(","num_cpus=2",",","resources=","{","``","CustomResource","''",":","1","}",")","class","Foo",":","def","method","(","self",")",":","return","1","#","Class","Bar","will","require","1","cpu","instead","of","2",".","#","It","will","also","require","no","custom","resources",".","Bar","=","Foo.options","(","num_cpus=1",",","resources=None",")"]
code: def options(self, **actor_options):
      """Configures and overrides the actor instantiation parameters.
  
      The arguments are the same as those that can be passed
      to :obj:`ray.remote`.
  
      Args:
          num_cpus: The quantity of CPU cores to reserve
              for this task or for the lifetime of the actor.
          num_gpus: The quantity of GPUs to reserve
              for this task or for the lifetime of the actor.
          resources (Dict[str, float]): The quantity of various custom resources
              to reserve for this task or for the lifetime of the actor.
              This is a dictionary mapping strings (resource names) to floats.
          accelerator_type: If specified, requires that the task or actor run
              on a node with the specified type of accelerator.
              See :ref:`accelerator types <accelerator_types>`.
          memory: The heap memory request in bytes for this task/actor,
              rounded down to the nearest integer.
          object_store_memory: The object store memory request for actors only.
          max_restarts: This specifies the maximum
              number of times that the actor should be restarted when it dies
              unexpectedly. The minimum valid value is 0 (default),
              which indicates that the actor doesn't need to be restarted.
              A value of -1 indicates that an actor should be restarted
              indefinitely.
          max_task_retries: How many times to
              retry an actor task if the task fails due to a system error,
              e.g., the actor has died. If set to -1, the system will
              retry the failed task until the task succeeds, or the actor
              has reached its max_restarts limit. If set to `n > 0`, the
              system will retry the failed task up to n times, after which the
              task will throw a `RayActorError` exception upon :obj:`ray.get`.
              Note that Python exceptions are not considered system errors
              and don't trigger retries. [Internal use: You can override this number
              with the method's "_max_retries" option at @ray.method decorator or
              at .option() time.]
          max_pending_calls: Set the max number of pending calls
              allowed on the actor handle. When this value is exceeded,
              PendingCallsLimitExceeded will be raised for further tasks.
              Note that this limit is counted per handle. -1 means that the
              number of pending calls is unlimited.
          max_concurrency: The max number of concurrent calls to allow for
              this actor. This only works with direct actor calls. The max
              concurrency defaults to 1 for threaded execution, and 1000 for
              asyncio execution. Note that the execution order is not
              guaranteed when max_concurrency > 1.
          name: The globally unique name for the actor, which can be used
              to retrieve the actor via ray.get_actor(name) as long as the
              actor is still alive.
          namespace: Override the namespace to use for the actor. By default,
              actors are created in an anonymous namespace. The actor can
              be retrieved via ray.get_actor(name=name, namespace=namespace).
          lifetime: Either `None`, which defaults to the actor will fate
              share with its creator and will be deleted once its refcount
              drops to zero, or "detached", which means the actor will live
              as a global object independent of the creator.
          runtime_env (Dict[str, Any]): Specifies the runtime environment for
              this actor or task and its children. See
              :ref:`runtime-environments` for detailed documentation.
          scheduling_strategy: Strategy about how to
              schedule a remote function or actor. Possible values are
              None: ray will figure out the scheduling strategy to use, it
              will either be the PlacementGroupSchedulingStrategy using parent's
              placement group if parent has one and has
              placement_group_capture_child_tasks set to true,
              or "DEFAULT";
              "DEFAULT": default hybrid scheduling;
              "SPREAD": best effort spread scheduling;
              `PlacementGroupSchedulingStrategy`:
              placement group based scheduling;
              `NodeAffinitySchedulingStrategy`:
              node id based affinity scheduling.
          _metadata: Extended options for Ray libraries. For example,
              _metadata={"workflows.io/options": <workflow options>} for
              Ray workflows.
  
      Examples:
  
      .. code-block:: python
  
          @ray.remote(num_cpus=2, resources={"CustomResource": 1})
          class Foo:
              def method(self):
                  return 1
          # Class Bar will require 1 cpu instead of 2.
          # It will also require no custom resources.
          Bar = Foo.options(num_cpus=1, resources=None)
      """
  
      actor_cls = self
  
      # override original options
      default_options = self._default_options.copy()
      # "concurrency_groups" could not be used in ".options()",
      # we should remove it before merging options from '@ray.remote'.
      default_options.pop("concurrency_groups", None)
      updated_options = ray_option_utils.update_options(
          default_options, actor_options
      )
      ray_option_utils.validate_actor_options(
          updated_options, in_options=True
      )
  
      # only update runtime_env when ".options()" specifies new runtime_env
      if "runtime_env" in actor_options:
          updated_options["runtime_env"] = parse_runtime_env(
              updated_options["runtime_env"]
          )
  
      class ActorOptionWrapper:
          def remote(self, *args, **kwargs):
              return actor_cls._remote(
                  args=args, kwargs=kwargs, **updated_options
              )
  
          @DeveloperAPI
          def bind(self, *args, **kwargs):
              """
              For Ray DAG building that creates static graph from decorated
              class or functions.
              """
              from ray.dag.class_node import ClassNode
  
              return ClassNode(
                  actor_cls.__ray_metadata__.modified_class,
                  args,
                  kwargs,
                  updated_options,
              )
  
      return ActorOptionWrapper()
  
imports: import inspect
  import logging
  import weakref
  from typing import Any, Dict, List, Optional, Union
  import ray._private.ray_constants
  import ray._private.signature
  import ray._private.worker
  import ray._raylet
  from ray import ActorClassID, Language, cross_language
  from ray._private import ray_option_utils
  from ray._private.async_compat import is_async_func
  from ray._private.auto_init_hook import wrap_auto_init
  from ray._private.client_mode_hook import client_mode_convert_actor, client_mode_hook, client_mode_should_convert
  from ray._private.inspect_util import is_class_method, is_function_or_method, is_static_method
  from ray._private.ray_option_utils import _warn_if_using_deprecated_placement_group
  from ray._private.utils import get_runtime_env_info, parse_runtime_env
  from ray._raylet import STREAMING_GENERATOR_RETURN, ObjectRefGenerator, PythonFunctionDescriptor, raise_sys_exit_with_custom_error_message
  from ray.exceptions import AsyncioActorExit
  from ray.util.annotations import DeveloperAPI, PublicAPI
  from ray.util.placement_group import _configure_placement_group_based_on_context
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy, SchedulingStrategyT
  from ray.util.tracing.tracing_helper import _inject_tracing_into_class, _tracing_actor_creation, _tracing_actor_method_invocation
label_desc: Use image node_id 6 for calling the ActorClass obj's underlying member method code with example usage: obj.options() and returns: ActorOptionWrapper, actor_cls, ClassNode