MCPcopy
hub / github.com/ray-project/ray / ActorHandle

Class ActorHandle

python/ray/actor.py:2128–2645  ·  view source on GitHub ↗

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 tas

Source from the content-addressed store, hash-verified

2126
2127@PublicAPI
2128class ActorHandle(Generic[T]):
2129 """A handle to an actor.
2130
2131 The fields in this class are prefixed with _ray_ to hide them from the user
2132 and to avoid collision with actor method names.
2133
2134 An ActorHandle can be created in three ways. First, by calling .remote() on
2135 an ActorClass. Second, by passing an actor handle into a task (forking the
2136 ActorHandle). Third, by directly serializing the ActorHandle (e.g., with
2137 cloudpickle).
2138
2139 Attributes:
2140 _ray_actor_language: The actor language.
2141 _ray_actor_id: Actor ID.
2142 _ray_enable_task_events: The default value of whether task events is
2143 enabled, i.e., task events from the actor should be reported.
2144 _ray_method_is_generator: Map of method name -> if it is a generator
2145 method.
2146 _ray_method_decorators: Optional decorators for the function
2147 invocation. This can be used to change the behavior on the
2148 invocation side, whereas a regular decorator can be used to change
2149 the behavior on the execution side.
2150 _ray_method_signatures: The signatures of the actor methods.
2151 _ray_method_max_task_retries: Max number of retries on method failure.
2152 _ray_method_num_returns: The default number of return values for
2153 each method.
2154 _ray_method_retry_exceptions: The default value of boolean of whether you want
2155 to retry all user-raised exceptions, or a list of allowlist exceptions to
2156 retry.
2157 _ray_method_generator_backpressure_num_objects: Generator-only
2158 config. The max number of objects to generate before it
2159 starts pausing a generator.
2160 _ray_method_enable_task_events: The value of whether task
2161 tracing is enabled for the actor methods. This overrides the
2162 actor's default value (`_ray_enable_task_events`).
2163 _ray_method_name_to_tensor_transport: A dictionary mapping method names to their
2164 tensor transport protocol.
2165 _ray_actor_method_cpus: The number of CPUs required by actor methods.
2166 _ray_original_handle: True if this is the original actor handle for a
2167 given actor. If this is true, then the actor will be destroyed when
2168 this handle goes out of scope.
2169 _ray_weak_ref: True means that this handle does not count towards the
2170 distributed ref count for the actor, i.e. the actor may be GCed
2171 while this handle is still in scope. This is set to True if the
2172 handle was created by getting an actor by name or by getting the
2173 self handle. It is set to False if this is the original handle or
2174 if it was created by passing the original handle through task args
2175 and returns.
2176 _ray_is_cross_language: Whether this actor is cross language.
2177 _ray_actor_creation_function_descriptor: The function descriptor
2178 of the actor creation task.
2179 _ray_allow_out_of_order_execution: Whether the actor can execute tasks out of order.
2180 _ray_enable_tensor_transport: Whether tensor transport is enabled for this actor.
2181 """
2182
2183 def __init__(
2184 self,
2185 language,

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…