diff --git a/python/ray/__init__.py b/python/ray/__init__.py index e689eb9fc..d05aa6d9e 100644 --- a/python/ray/__init__.py +++ b/python/ray/__init__.py @@ -51,8 +51,8 @@ from ray.profiling import profile # noqa: E402 from ray.worker import (error_info, init, connect, disconnect, get, put, wait, remote, get_gpu_ids, get_resource_ids, get_webui_url, register_custom_serializer, shutdown) # noqa: E402 -from ray.worker import (SCRIPT_MODE, WORKER_MODE, LOCAL_MODE, - SILENT_MODE) # noqa: E402 +from ray.worker import (SCRIPT_MODE, WORKER_MODE, LOCAL_MODE, SILENT_MODE, + PYTHON_MODE) # noqa: E402 from ray.worker import global_state # noqa: E402 # We import ray.actor because some code is run in actor.py which initializes # some functions in the worker. @@ -67,8 +67,8 @@ __all__ = [ "error_info", "init", "connect", "disconnect", "get", "put", "wait", "remote", "profile", "actor", "method", "get_gpu_ids", "get_resource_ids", "get_webui_url", "register_custom_serializer", "shutdown", "SCRIPT_MODE", - "WORKER_MODE", "LOCAL_MODE", "SILENT_MODE", "global_state", "ObjectID", - "_config", "__version__" + "WORKER_MODE", "LOCAL_MODE", "SILENT_MODE", "PYTHON_MODE", "global_state", + "ObjectID", "_config", "__version__" ] import ctypes # noqa: E402 diff --git a/python/ray/worker.py b/python/ray/worker.py index 488283c55..d00c28dda 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -44,6 +44,7 @@ SCRIPT_MODE = 0 WORKER_MODE = 1 LOCAL_MODE = 2 SILENT_MODE = 3 +PYTHON_MODE = 4 ERROR_KEY_PREFIX = b"Error:" DRIVER_ID_LENGTH = 20 @@ -1574,6 +1575,9 @@ def _init(address_info=None, Exception: An exception is raised if an inappropriate combination of arguments is passed in. """ + if driver_mode == PYTHON_MODE: + raise Exception("ray.PYTHON_MODE has been renamed to ray.LOCAL_MODE. " + "Please use ray.LOCAL_MODE.") if driver_mode not in [SCRIPT_MODE, LOCAL_MODE, SILENT_MODE]: raise Exception("Driver_mode must be in [ray.SCRIPT_MODE, " "ray.LOCAL_MODE, ray.SILENT_MODE].")