From b0510ee46119077803c8890469c91e9bdf73740d Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Wed, 7 Mar 2018 10:36:49 -0800 Subject: [PATCH] Give error when actor is created before ray.init. (#1666) --- python/ray/actor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/ray/actor.py b/python/ray/actor.py index cedd9c6f1..4df9a45b2 100644 --- a/python/ray/actor.py +++ b/python/ray/actor.py @@ -706,6 +706,10 @@ def actor_handle_from_class(Class, class_id, resources, checkpoint_interval): @classmethod def remote(cls, *args, **kwargs): + if ray.worker.global_worker.mode is None: + raise Exception("Actors cannot be created before ray.init() " + "has been called.") + actor_id = random_actor_id() # The ID for this instance of ActorHandle. These should be unique # across instances with the same _ray_actor_id.