Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ray Client] Transfer dashboard_url over gRPC instead of ray.remote #30941

Merged
merged 4 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/ray/client_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ def connect(self) -> ClientContext:
ray_init_kwargs=self._remote_init_kwargs,
metadata=self._metadata,
)
get_dashboard_url = ray.remote(ray._private.worker.get_dashboard_url)
dashboard_url = ray.get(get_dashboard_url.options(num_cpus=0).remote())

dashboard_url = ray.util.client.ray._get_dashboard_url()

cxt = ClientContext(
dashboard_url=dashboard_url,
python_version=client_info_dict["python_version"],
Expand Down
12 changes: 11 additions & 1 deletion python/ray/tests/test_client_reconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,17 @@ def ListNamedActors(
return self._call_inner_function(request, context, "ListNamedActors")

def ClusterInfo(self, request, context=None) -> ray_client_pb2.ClusterInfoResponse:
return self._call_inner_function(request, context, "ClusterInfo")
# Cluster info is currently used for health checks and isn't retried, so
# don't inject errors.
# TODO(ckw): update ClusterInfo so that retries are only skipped for PING
try:
return self.stub.ClusterInfo(
request, metadata=context.invocation_metadata()
)
except grpc.RpcError as e:
context.set_code(e.code())
context.set_details(e.details())
raise

def Terminate(self, req, context=None):
return self._call_inner_function(req, context, "Terminate")
Expand Down
2 changes: 1 addition & 1 deletion python/ray/util/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# This version string is incremented to indicate breaking changes in the
# protocol that require upgrading the client version.
CURRENT_PROTOCOL_VERSION = "2022-10-05"
CURRENT_PROTOCOL_VERSION = "2022-12-06"


class _ClientContext:
Expand Down
7 changes: 7 additions & 0 deletions python/ray/util/client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,10 @@ def _register_callback(
self, ref: "ClientObjectRef", callback: Callable[["DataResponse"], None]
) -> None:
self.worker.register_callback(ref, callback)

def _get_dashboard_url(self) -> str:
import ray.core.generated.ray_client_pb2 as ray_client_pb2

return self.worker.get_cluster_info(
ray_client_pb2.ClusterInfoType.DASHBOARD_URL
).get("dashboard_url", "")
2 changes: 2 additions & 0 deletions python/ray/util/client/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ def _return_debug_cluster_info(self, request, context=None) -> str:
data = ray.timeline()
elif request.type == ray_client_pb2.ClusterInfoType.PING:
data = {}
elif request.type == ray_client_pb2.ClusterInfoType.DASHBOARD_URL:
data = {"dashboard_url": ray._private.worker.get_dashboard_url()}
else:
raise TypeError("Unsupported cluster info type")
return json.dumps(data)
Expand Down
1 change: 1 addition & 0 deletions src/ray/protobuf/ray_client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ message ClusterInfoType {
RUNTIME_CONTEXT = 4;
TIMELINE = 5;
PING = 6;
DASHBOARD_URL = 7;
}
}

Expand Down