mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 21:08:13 +08:00
Remove top-level ray.connect() and ray.disconnect() APIs (#13273)
This commit is contained in:
+14
-25
@@ -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
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user