From 1ab0d0ea694d21c2406b499db67126847f016924 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Mon, 26 Mar 2018 18:31:26 -0700 Subject: [PATCH] Acquire worker lock when importing actor. (#1783) --- python/ray/worker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ray/worker.py b/python/ray/worker.py index 17be17009..e2fd1f6a6 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -881,7 +881,8 @@ class Worker(object): while key not in self.imported_actor_classes: time.sleep(0.001) - self.fetch_and_register_actor(key, task.required_resources(), self) + with self.lock: + self.fetch_and_register_actor(key, task.required_resources(), self) def _wait_for_and_process_task(self, task): """Wait for a task to be ready and process the task.