mirror of
https://github.com/wassname/ray.git
synced 2026-07-08 22:55:05 +08:00
[Serve] Disable serialization for client and print helpful msg (#11181)
This commit is contained in:
@@ -7,7 +7,7 @@ from ray.serve.constants import (DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT,
|
||||
from ray.serve.controller import ServeController
|
||||
from ray.serve.handle import RayServeHandle
|
||||
from ray.serve.utils import (block_until_http_ready, format_actor_name,
|
||||
get_random_letters)
|
||||
get_random_letters, logger)
|
||||
from ray.serve.exceptions import RayServeException
|
||||
from ray.serve.config import BackendConfig, ReplicaConfig, BackendMetadata
|
||||
from ray.actor import ActorHandle
|
||||
@@ -53,8 +53,16 @@ class Client:
|
||||
|
||||
def __del__(self):
|
||||
if not self._detached:
|
||||
logger.info("Shutting down Ray Serve because client went out of "
|
||||
"scope. To prevent this, either keep a reference to "
|
||||
"the client object or use serve.start(detached=True).")
|
||||
self.shutdown()
|
||||
|
||||
def __reduce__(self):
|
||||
raise RayServeException(
|
||||
("Ray Serve client cannot be serialized. Please use "
|
||||
"serve.connect() to get a client from within a backend."))
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""Completely shut down the connected Serve instance.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user