mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 16:14:06 +08:00
Fix actor handle id creation when actor handle was pickled (#3074)
This commit is contained in:
committed by
Robert Nishihara
parent
3c0803e7e9
commit
2c52d9dfa0
@@ -501,6 +501,7 @@ class ActorHandle(object):
|
||||
self._ray_actor_method_cpus = actor_method_cpus
|
||||
self._ray_actor_driver_id = actor_driver_id
|
||||
self._ray_previous_actor_handle_id = previous_actor_handle_id
|
||||
self._ray_previously_generated_actor_handle_id = None
|
||||
|
||||
def _actor_method_call(self,
|
||||
method_name,
|
||||
@@ -554,10 +555,22 @@ class ActorHandle(object):
|
||||
|
||||
is_actor_checkpoint_method = (method_name == "__ray_checkpoint__")
|
||||
|
||||
# Right now, if the actor handle has been pickled, we create a
|
||||
# temporary actor handle id for invocations.
|
||||
# TODO(pcm): This still leads to a lot of actor handles being
|
||||
# created, there should be a better way to handle pickled
|
||||
# actor handles.
|
||||
if self._ray_actor_handle_id is None:
|
||||
actor_handle_id = compute_actor_handle_id_non_forked(
|
||||
self._ray_actor_id, self._ray_previous_actor_handle_id,
|
||||
worker.current_task_id)
|
||||
# Each new task creates a new actor handle id, so we need to
|
||||
# reset the actor counter to 0
|
||||
if (actor_handle_id !=
|
||||
self._ray_previously_generated_actor_handle_id):
|
||||
self._ray_actor_counter = 0
|
||||
self._ray_previously_generated_actor_handle_id = (
|
||||
actor_handle_id)
|
||||
else:
|
||||
actor_handle_id = self._ray_actor_handle_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user