Remove top-level ray.connect() and ray.disconnect() APIs (#13273)

This commit is contained in:
Edward Oakes
2021-01-08 15:26:20 -06:00
committed by GitHub
parent 300a22d8f7
commit 66daed99f5
2 changed files with 16 additions and 27 deletions
+14 -25
View File
@@ -62,38 +62,29 @@ if os.path.exists(so_path):
import ray._raylet # noqa: E402
from ray._raylet import (
ActorClassID,
ActorID,
NodeID,
Config as _Config,
JobID,
WorkerID,
FunctionID,
ObjectID,
ObjectRef,
TaskID,
UniqueID,
Language,
from ray._raylet import ( # noqa: E402
ActorClassID, ActorID, NodeID, Config as _Config, JobID, WorkerID,
FunctionID, ObjectID, ObjectRef, TaskID, UniqueID, Language,
PlacementGroupID,
) # noqa: E402
)
_config = _Config()
from ray.profiling import profile # noqa: E402
from ray.state import (jobs, nodes, actors, objects, timeline,
object_transfer_timeline, cluster_resources,
available_resources) # noqa: E402
from ray.worker import ( # noqa: F401
from ray.state import ( # noqa: E402
jobs, nodes, actors, objects, timeline, object_transfer_timeline,
cluster_resources, available_resources,
)
from ray.worker import ( # noqa: E402,F401
LOCAL_MODE, SCRIPT_MODE, WORKER_MODE, RESTORE_WORKER_MODE,
SPILL_WORKER_MODE, cancel, connect, disconnect, get, get_actor,
get_gpu_ids, get_resource_ids, get_dashboard_url, init, is_initialized,
put, kill, remote, shutdown, show_in_dashboard, wait,
) # noqa: E402
SPILL_WORKER_MODE, cancel, get, get_actor, get_gpu_ids, get_resource_ids,
get_dashboard_url, init, is_initialized, put, kill, remote, shutdown,
show_in_dashboard, wait,
)
import ray.internal # noqa: E402
# We import ray.actor because some code is run in actor.py which initializes
# some functions in the worker.
import ray.actor # noqa: F401
import ray.actor # noqa: E402,F401
from ray.actor import method # noqa: E402
from ray.cross_language import java_function, java_actor_class # noqa: E402
from ray.runtime_context import get_runtime_context # noqa: E402
@@ -113,8 +104,6 @@ __all__ = [
"available_resources",
"cancel",
"cluster_resources",
"connect",
"disconnect",
"get",
"get_actor",
"get_gpu_ids",
+2 -2
View File
@@ -178,7 +178,7 @@ class ActorClassMethodMetadata(object):
each actor method.
"""
_cache = {} # This cache will be cleared in ray.disconnect()
_cache = {} # This cache will be cleared in ray.worker.disconnect()
def __init__(self):
class_name = type(self).__name__
@@ -1017,7 +1017,7 @@ def exit_actor():
if worker.mode == ray.WORKER_MODE and not worker.actor_id.is_nil():
# Intentionally disconnect the core worker from the raylet so the
# raylet won't push an error message to the driver.
ray.disconnect()
ray.worker.disconnect()
# Disconnect global state from GCS.
ray.state.state.disconnect()