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

[Serve] Expose ProxyStatus class to API docs (#43394) #48299

Merged
merged 8 commits into from
Oct 30, 2024
1 change: 1 addition & 0 deletions doc/source/serve/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ Content-Type: application/json
schema.ApplicationDetails
schema.DeploymentDetails
schema.ReplicaDetails
schema.ProxyStatus
```

## Observability
Expand Down
2 changes: 1 addition & 1 deletion python/ray/dashboard/client/src/type/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions python/ray/serve/_private/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions python/ray/serve/_private/proxy_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
17 changes: 16 additions & 1 deletion python/ray/serve/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from ray.serve._private.common import (
DeploymentStatus,
DeploymentStatusTrigger,
ProxyStatus,
ReplicaState,
ServeDeployMode,
)
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions python/ray/serve/tests/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ====
Expand Down
3 changes: 1 addition & 2 deletions python/ray/serve/tests/test_proxy_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 1 addition & 2 deletions python/ray/serve/tests/test_standalone_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down