diff --git a/doc/source/serve/api/index.md b/doc/source/serve/api/index.md index 9f72b610ca0e..9308dd8e3b33 100644 --- a/doc/source/serve/api/index.md +++ b/doc/source/serve/api/index.md @@ -378,6 +378,7 @@ Content-Type: application/json schema.ApplicationDetails schema.DeploymentDetails schema.ReplicaDetails + schema.ProxyStatus ``` ## Observability diff --git a/python/ray/dashboard/client/src/type/serve.ts b/python/ray/dashboard/client/src/type/serve.ts index e079f41b9ffb..c343a1c188bf 100644 --- a/python/ray/dashboard/client/src/type/serve.ts +++ b/python/ray/dashboard/client/src/type/serve.ts @@ -87,7 +87,7 @@ export enum ServeProxyLocation { FixedNumber = "FixedNumber", } -// Keep in sync with ProxyStatus in python/ray/serve/_private/common.py +// Keep in sync with ProxyStatus in python/ray/serve/schema.py export enum ServeSystemActorStatus { STARTING = "STARTING", HEALTHY = "HEALTHY", diff --git a/python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py b/python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py index cfb56a0c6f20..dc4afb5fb2e2 100644 --- a/python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py +++ b/python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py @@ -12,11 +12,10 @@ from ray.serve._private.common import ( DeploymentStatus, DeploymentStatusTrigger, - ProxyStatus, ReplicaState, ) from ray.serve._private.constants import SERVE_NAMESPACE -from ray.serve.schema import ApplicationStatus, ServeInstanceDetails +from ray.serve.schema import ApplicationStatus, ProxyStatus, ServeInstanceDetails from ray.serve.tests.conftest import * # noqa: F401 F403 from ray.tests.conftest import * # noqa: F401 F403 from ray.util.state import list_actors diff --git a/python/ray/serve/_private/common.py b/python/ray/serve/_private/common.py index 6019a121d7f4..c1b77d0eb3ca 100644 --- a/python/ray/serve/_private/common.py +++ b/python/ray/serve/_private/common.py @@ -520,19 +520,6 @@ class ServeDeployMode(str, Enum): MULTI_APP = "MULTI_APP" -# Keep in sync with ServeSystemActorStatus in -# python/ray/dashboard/client/src/type/serve.ts -class ProxyStatus(str, Enum): - STARTING = "STARTING" - HEALTHY = "HEALTHY" - UNHEALTHY = "UNHEALTHY" - DRAINING = "DRAINING" - # The DRAINED status is a momentary state - # just before the proxy is removed - # so this status won't show up on the dashboard. - DRAINED = "DRAINED" - - class ServeComponentType(str, Enum): REPLICA = "replica" diff --git a/python/ray/serve/_private/proxy_state.py b/python/ray/serve/_private/proxy_state.py index 0b86789f0fea..3325bbe0ee10 100644 --- a/python/ray/serve/_private/proxy_state.py +++ b/python/ray/serve/_private/proxy_state.py @@ -10,7 +10,7 @@ from ray.actor import ActorHandle from ray.exceptions import RayActorError from ray.serve._private.cluster_node_info_cache import ClusterNodeInfoCache -from ray.serve._private.common import NodeId, ProxyStatus +from ray.serve._private.common import NodeId from ray.serve._private.constants import ( ASYNC_CONCURRENCY, PROXY_DRAIN_CHECK_PERIOD_S, @@ -27,7 +27,7 @@ from ray.serve._private.proxy import ProxyActor from ray.serve._private.utils import Timer, TimerBase, format_actor_name from ray.serve.config import DeploymentMode, HTTPOptions, gRPCOptions -from ray.serve.schema import LoggingConfig, ProxyDetails +from ray.serve.schema import LoggingConfig, ProxyDetails, ProxyStatus from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy logger = logging.getLogger(SERVE_LOGGER_NAME) diff --git a/python/ray/serve/schema.py b/python/ray/serve/schema.py index 5556b341af36..ed696219b0c3 100644 --- a/python/ray/serve/schema.py +++ b/python/ray/serve/schema.py @@ -19,7 +19,6 @@ from ray.serve._private.common import ( DeploymentStatus, DeploymentStatusTrigger, - ProxyStatus, ReplicaState, ServeDeployMode, ) @@ -788,6 +787,22 @@ def get_empty_schema_dict() -> Dict: return {"applications": []} +# Keep in sync with ServeSystemActorStatus in +# python/ray/dashboard/client/src/type/serve.ts +@PublicAPI(stability="stable") +class ProxyStatus(str, Enum): + """The current status of the proxy.""" + + STARTING = "STARTING" + HEALTHY = "HEALTHY" + UNHEALTHY = "UNHEALTHY" + DRAINING = "DRAINING" + # The DRAINED status is a momentary state + # just before the proxy is removed + # so this status won't show up on the dashboard. + DRAINED = "DRAINED" + + @PublicAPI(stability="alpha") @dataclass class DeploymentStatusOverview: diff --git a/python/ray/serve/tests/test_callback.py b/python/ray/serve/tests/test_callback.py index 189d7f581e33..0bedd26d1d92 100644 --- a/python/ray/serve/tests/test_callback.py +++ b/python/ray/serve/tests/test_callback.py @@ -12,10 +12,9 @@ from ray import serve from ray._private.test_utils import wait_for_condition from ray.exceptions import RayActorError -from ray.serve._private.common import ProxyStatus from ray.serve._private.utils import call_function_from_import_path from ray.serve.context import _get_global_client -from ray.serve.schema import LoggingConfig, ServeInstanceDetails +from ray.serve.schema import LoggingConfig, ProxyStatus, ServeInstanceDetails # ==== Callbacks used in this test ==== diff --git a/python/ray/serve/tests/test_proxy_state.py b/python/ray/serve/tests/test_proxy_state.py index c84dea865872..70dccde7cf95 100644 --- a/python/ray/serve/tests/test_proxy_state.py +++ b/python/ray/serve/tests/test_proxy_state.py @@ -6,13 +6,12 @@ from ray._private.test_utils import wait_for_condition from ray.serve._private.cluster_node_info_cache import ClusterNodeInfoCache -from ray.serve._private.common import ProxyStatus from ray.serve._private.constants import PROXY_HEALTH_CHECK_UNHEALTHY_THRESHOLD from ray.serve._private.proxy_state import ProxyState, ProxyStateManager, ProxyWrapper from ray.serve._private.test_utils import MockTimer from ray.serve._private.utils import Timer from ray.serve.config import DeploymentMode, HTTPOptions -from ray.serve.schema import LoggingConfig +from ray.serve.schema import LoggingConfig, ProxyStatus HEAD_NODE_ID = "node_id-index-head" diff --git a/python/ray/serve/tests/test_standalone_3.py b/python/ray/serve/tests/test_standalone_3.py index 2b11becf41f3..13959a59ab33 100644 --- a/python/ray/serve/tests/test_standalone_3.py +++ b/python/ray/serve/tests/test_standalone_3.py @@ -15,12 +15,11 @@ from ray._private.test_utils import SignalActor, wait_for_condition from ray.cluster_utils import AutoscalingCluster, Cluster from ray.exceptions import RayActorError -from ray.serve._private.common import ProxyStatus from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME, SERVE_LOGGER_NAME from ray.serve._private.logging_utils import get_serve_logs_dir from ray.serve._private.utils import get_head_node_id from ray.serve.context import _get_global_client -from ray.serve.schema import ServeInstanceDetails +from ray.serve.schema import ProxyStatus, ServeInstanceDetails from ray.tests.conftest import call_ray_stop_only # noqa: F401