ray.actor.ActorHandle#
- class ray.actor.ActorHandle(language, actor_id, max_task_retries: int | None, enable_task_events: bool, method_is_generator: Dict[str, bool], method_decorators, method_signatures, method_num_returns: Dict[str, int | Literal['streaming']], method_max_task_retries: Dict[str, int], method_retry_exceptions: Dict[str, bool | list | tuple], method_generator_backpressure_num_objects: Dict[str, int], method_enable_task_events: Dict[str, bool], actor_method_cpus: int, actor_creation_function_descriptor, cluster_and_job, original_handle=False, weak_ref: bool = False)[source]#
A handle to an actor.
The fields in this class are prefixed with _ray_ to hide them from the user and to avoid collision with actor method names.
An ActorHandle can be created in three ways. First, by calling .remote() on an ActorClass. Second, by passing an actor handle into a task (forking the ActorHandle). Third, by directly serializing the ActorHandle (e.g., with cloudpickle).
- _ray_actor_language#
The actor language.
- _ray_actor_id#
Actor ID.
- _ray_enable_task_events#
The default value of whether task events is enabled, i.e., task events from the actor should be reported.
- _ray_method_is_generator#
Map of method name -> if it is a generator method.
- _ray_method_decorators#
Optional decorators for the function invocation. This can be used to change the behavior on the invocation side, whereas a regular decorator can be used to change the behavior on the execution side.
- _ray_method_signatures#
The signatures of the actor methods.
- _ray_method_max_task_retries#
Max number of retries on method failure.
- _ray_method_num_returns#
The default number of return values for each method.
- _ray_method_retry_exceptions#
The default value of boolean of whether you want to retry all user-raised exceptions, or a list of allowlist exceptions to retry.
- _ray_method_generator_backpressure_num_objects#
Generator-only config. The max number of objects to generate before it starts pausing a generator.
- _ray_method_enable_task_events#
The value of whether task tracing is enabled for the actor methods. This overrides the actor’s default value (
_ray_enable_task_events
).
- _ray_actor_method_cpus#
The number of CPUs required by actor methods.
- _ray_original_handle#
True if this is the original actor handle for a given actor. If this is true, then the actor will be destroyed when this handle goes out of scope.
- _ray_weak_ref#
True means that this handle does not count towards the distributed ref count for the actor, i.e. the actor may be GCed while this handle is still in scope. This is set to True if the handle was created by getting an actor by name or by getting the self handle. It is set to False if this is the original handle or if it was created by passing the original handle through task args and returns.
- _ray_is_cross_language#
Whether this actor is cross language.
- _ray_actor_creation_function_descriptor#
The function descriptor of the actor creation task.
Methods