Skip to content

Commit

Permalink
[Serve] Expose ProxyStatus class to API docs (ray-project#43394) (ray…
Browse files Browse the repository at this point in the history
…-project#48299)

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->
This PR moves `ProxyStatus` out of the `_private` directory, allowing it
to be included in the API docs. This is the final attribute of
`ServeStatus` that needs to be included in the documentation.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->
Closes ray-project#43394

---------

Signed-off-by: akyang-anyscale <[email protected]>
Signed-off-by: mohitjain2504 <[email protected]>
  • Loading branch information
akyang-anyscale authored and mohitjain2504 committed Nov 15, 2024
1 parent 230ce9d commit f48d8f3
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 25 deletions.
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

0 comments on commit f48d8f3

Please sign in to comment.