mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +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
|
import ray._raylet # noqa: E402
|
||||||
|
|
||||||
from ray._raylet import (
|
from ray._raylet import ( # noqa: E402
|
||||||
ActorClassID,
|
ActorClassID, ActorID, NodeID, Config as _Config, JobID, WorkerID,
|
||||||
ActorID,
|
FunctionID, ObjectID, ObjectRef, TaskID, UniqueID, Language,
|
||||||
NodeID,
|
|
||||||
Config as _Config,
|
|
||||||
JobID,
|
|
||||||
WorkerID,
|
|
||||||
FunctionID,
|
|
||||||
ObjectID,
|
|
||||||
ObjectRef,
|
|
||||||
TaskID,
|
|
||||||
UniqueID,
|
|
||||||
Language,
|
|
||||||
PlacementGroupID,
|
PlacementGroupID,
|
||||||
) # noqa: E402
|
)
|
||||||
|
|
||||||
_config = _Config()
|
_config = _Config()
|
||||||
|
|
||||||
from ray.profiling import profile # noqa: E402
|
from ray.profiling import profile # noqa: E402
|
||||||
from ray.state import (jobs, nodes, actors, objects, timeline,
|
from ray.state import ( # noqa: E402
|
||||||
object_transfer_timeline, cluster_resources,
|
jobs, nodes, actors, objects, timeline, object_transfer_timeline,
|
||||||
available_resources) # noqa: E402
|
cluster_resources, available_resources,
|
||||||
from ray.worker import ( # noqa: F401
|
)
|
||||||
|
from ray.worker import ( # noqa: E402,F401
|
||||||
LOCAL_MODE, SCRIPT_MODE, WORKER_MODE, RESTORE_WORKER_MODE,
|
LOCAL_MODE, SCRIPT_MODE, WORKER_MODE, RESTORE_WORKER_MODE,
|
||||||
SPILL_WORKER_MODE, cancel, connect, disconnect, get, get_actor,
|
SPILL_WORKER_MODE, cancel, get, get_actor, get_gpu_ids, get_resource_ids,
|
||||||
get_gpu_ids, get_resource_ids, get_dashboard_url, init, is_initialized,
|
get_dashboard_url, init, is_initialized, put, kill, remote, shutdown,
|
||||||
put, kill, remote, shutdown, show_in_dashboard, wait,
|
show_in_dashboard, wait,
|
||||||
) # noqa: E402
|
)
|
||||||
import ray.internal # noqa: E402
|
import ray.internal # noqa: E402
|
||||||
# We import ray.actor because some code is run in actor.py which initializes
|
# We import ray.actor because some code is run in actor.py which initializes
|
||||||
# some functions in the worker.
|
# 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.actor import method # noqa: E402
|
||||||
from ray.cross_language import java_function, java_actor_class # noqa: E402
|
from ray.cross_language import java_function, java_actor_class # noqa: E402
|
||||||
from ray.runtime_context import get_runtime_context # noqa: E402
|
from ray.runtime_context import get_runtime_context # noqa: E402
|
||||||
@@ -113,8 +104,6 @@ __all__ = [
|
|||||||
"available_resources",
|
"available_resources",
|
||||||
"cancel",
|
"cancel",
|
||||||
"cluster_resources",
|
"cluster_resources",
|
||||||
"connect",
|
|
||||||
"disconnect",
|
|
||||||
"get",
|
"get",
|
||||||
"get_actor",
|
"get_actor",
|
||||||
"get_gpu_ids",
|
"get_gpu_ids",
|
||||||
|
|||||||
+2
-2
@@ -178,7 +178,7 @@ class ActorClassMethodMetadata(object):
|
|||||||
each actor method.
|
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):
|
def __init__(self):
|
||||||
class_name = type(self).__name__
|
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():
|
if worker.mode == ray.WORKER_MODE and not worker.actor_id.is_nil():
|
||||||
# Intentionally disconnect the core worker from the raylet so the
|
# Intentionally disconnect the core worker from the raylet so the
|
||||||
# raylet won't push an error message to the driver.
|
# raylet won't push an error message to the driver.
|
||||||
ray.disconnect()
|
ray.worker.disconnect()
|
||||||
# Disconnect global state from GCS.
|
# Disconnect global state from GCS.
|
||||||
ray.state.state.disconnect()
|
ray.state.state.disconnect()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user