mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 13:15:35 +08:00
Fix multi-thread problem of function manager and Jenkins test (#3648)
This commit is contained in:
@@ -509,20 +509,29 @@ class FunctionActorManager(object):
|
||||
"""
|
||||
# We set the driver ID here because it may not have been available when
|
||||
# the actor class was defined.
|
||||
actor_class_info["driver_id"] = self._worker.task_driver_id.id()
|
||||
self._worker.redis_client.hmset(key, actor_class_info)
|
||||
self._worker.redis_client.rpush("Exports", key)
|
||||
|
||||
def export_actor_class(self, Class, actor_method_names,
|
||||
checkpoint_interval):
|
||||
function_descriptor = FunctionDescriptor.from_class(Class)
|
||||
key = (b"ActorClass:" + self._worker.task_driver_id.id() + b":" +
|
||||
# `task_driver_id` shouldn't be NIL, unless:
|
||||
# 1) This worker isn't an actor;
|
||||
# 2) And a previous task started a background thread, which didn't
|
||||
# finish before the task finished, and still uses Ray API
|
||||
# after that.
|
||||
assert not self._worker.task_driver_id.is_nil(), (
|
||||
"You might have started a background thread in a non-actor task, "
|
||||
"please make sure the thread finishes before the task finishes.")
|
||||
driver_id = self._worker.task_driver_id
|
||||
key = (b"ActorClass:" + driver_id.id() + b":" +
|
||||
function_descriptor.function_id.id())
|
||||
actor_class_info = {
|
||||
"class_name": Class.__name__,
|
||||
"module": Class.__module__,
|
||||
"class": pickle.dumps(Class),
|
||||
"checkpoint_interval": checkpoint_interval,
|
||||
"driver_id": driver_id.id(),
|
||||
"actor_method_names": json.dumps(list(actor_method_names))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user