ray.actor.ActorMethod.__init__#
- ActorMethod.__init__(actor, method_name, num_returns: int | Literal['streaming'] | None, max_task_retries: int, retry_exceptions: bool | list | tuple, is_generator: bool, generator_backpressure_num_objects: int, enable_task_events: bool, decorator=None, signature: List[Parameter] | None = None, hardref=False, tensor_transport: Literal[ray.core.generated.common_pb2.OBJECT_STORE, ray.core.generated.common_pb2.NCCL, ray.core.generated.common_pb2.GLOO] | None = None)[source]#
Initialize an ActorMethod.
- Parameters:
actor – The actor instance this method belongs to.
method_name – The name of the actor method.
num_returns – The default number of return values that the method invocation should return. If None is given, it uses DEFAULT_ACTOR_METHOD_NUM_RETURN_VALS for a normal actor task and “streaming” for a generator task (when
is_generator
is True).max_task_retries – Number of retries on method failure.
retry_exceptions – Boolean of whether you want to retry all user-raised exceptions, or a list of allowlist exceptions to retry.
is_generator – True if a given method is a Python generator.
generator_backpressure_num_objects – Generator-only config. If a number of unconsumed objects reach this threshold, a actor task stop pausing.
enable_task_events – True if task events is enabled, i.e., task events from the actor should be reported. Defaults to True.
decorator – An optional decorator that should be applied to the actor method invocation.
signature – The signature of the actor method. It is None only when cross language feature is used.
hardref – Whether to keep a hard reference to the actor.
tensor_transport – The tensor transport protocol to use for the actor method. The valid values are OBJECT_STORE (default), NCCL, or GLOO, and they are case-insensitive.