mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[serve] use true nulls in snapshot (#21062)
This commit is contained in:
parent
44320aba3b
commit
1c93beb490
5 changed files with 23 additions and 23 deletions
|
@ -135,7 +135,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
@ -196,7 +196,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
@ -140,7 +140,7 @@ my_func_deleted.delete()
|
|||
entry = data["data"]["snapshot"]["deployments"][hashlib.sha1(
|
||||
"my_func".encode()).hexdigest()]
|
||||
assert entry["name"] == "my_func"
|
||||
assert entry["version"] == "None"
|
||||
assert entry["version"] is None
|
||||
assert entry["namespace"] == "serve"
|
||||
assert entry["httpRoute"] == "/my_func"
|
||||
assert entry["className"] == "my_func"
|
||||
|
@ -154,7 +154,7 @@ my_func_deleted.delete()
|
|||
metadata = data["data"]["snapshot"]["actors"][actor_id]["metadata"][
|
||||
"serve"]
|
||||
assert metadata["deploymentName"] == "my_func"
|
||||
assert metadata["version"] == "None"
|
||||
assert metadata["version"] is None
|
||||
assert len(metadata["replicaTag"]) > 0
|
||||
|
||||
entry_deleted = data["data"]["snapshot"]["deployments"][hashlib.sha1(
|
||||
|
|
|
@ -25,10 +25,10 @@ class DeploymentInfo:
|
|||
deployment_config: DeploymentConfig,
|
||||
replica_config: ReplicaConfig,
|
||||
start_time_ms: int,
|
||||
deployer_job_id: "ray._raylet.JobID",
|
||||
actor_name: Optional[str] = None,
|
||||
serialized_deployment_def: Optional[bytes] = None,
|
||||
version: Optional[str] = None,
|
||||
deployer_job_id: "Optional[ray._raylet.JobID]" = None,
|
||||
end_time_ms: Optional[int] = None,
|
||||
autoscaling_policy: Optional[AutoscalingPolicy] = None):
|
||||
self.deployment_config = deployment_config
|
||||
|
|
|
@ -214,12 +214,10 @@ class ServeController:
|
|||
entry = dict()
|
||||
entry["name"] = deployment_name
|
||||
entry["namespace"] = ray.get_runtime_context().namespace
|
||||
entry["ray_job_id"] = ("None"
|
||||
if deployment_info.deployer_job_id is None
|
||||
else deployment_info.deployer_job_id.hex())
|
||||
entry["ray_job_id"] = deployment_info.deployer_job_id.hex()
|
||||
entry["class_name"] = (
|
||||
deployment_info.replica_config.func_or_class_name)
|
||||
entry["version"] = deployment_info.version or "None"
|
||||
entry["version"] = deployment_info.version
|
||||
entry["http_route"] = route_prefix
|
||||
entry["start_time"] = deployment_info.start_time_ms
|
||||
entry["end_time"] = deployment_info.end_time_ms or 0
|
||||
|
@ -238,10 +236,9 @@ class ServeController:
|
|||
continue
|
||||
actor_id = actor_handle._ray_actor_id.hex()
|
||||
replica_tag = replica.replica_tag
|
||||
replica_version = ("None"
|
||||
if (replica.version is None
|
||||
or replica.version.unversioned) else
|
||||
replica.version.code_version)
|
||||
replica_version = (None if (replica.version is None
|
||||
or replica.version.unversioned)
|
||||
else replica.version.code_version)
|
||||
entry["actors"][actor_id] = {
|
||||
"replica_tag": replica_tag,
|
||||
"version": replica_version
|
||||
|
@ -277,15 +274,16 @@ class ServeController:
|
|||
|
||||
return goal_ids
|
||||
|
||||
def deploy(self,
|
||||
name: str,
|
||||
deployment_config_proto_bytes: bytes,
|
||||
replica_config: ReplicaConfig,
|
||||
version: Optional[str],
|
||||
prev_version: Optional[str],
|
||||
route_prefix: Optional[str],
|
||||
deployer_job_id: "Optional[ray._raylet.JobID]" = None
|
||||
) -> Tuple[Optional[GoalId], bool]:
|
||||
def deploy(
|
||||
self,
|
||||
name: str,
|
||||
deployment_config_proto_bytes: bytes,
|
||||
replica_config: ReplicaConfig,
|
||||
version: Optional[str],
|
||||
prev_version: Optional[str],
|
||||
route_prefix: Optional[str],
|
||||
deployer_job_id: "ray._raylet.JobID",
|
||||
) -> Tuple[Optional[GoalId], bool]:
|
||||
if route_prefix is not None:
|
||||
assert route_prefix.startswith("/")
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from unittest.mock import patch, Mock
|
|||
|
||||
import pytest
|
||||
|
||||
import ray
|
||||
from ray.actor import ActorHandle
|
||||
from ray.serve.common import (
|
||||
DeploymentConfig,
|
||||
|
@ -161,7 +162,8 @@ def deployment_info(version: Optional[str] = None,
|
|||
start_time_ms=0,
|
||||
deployment_config=DeploymentConfig(
|
||||
num_replicas=num_replicas, user_config=user_config, **config_opts),
|
||||
replica_config=ReplicaConfig(lambda x: x))
|
||||
replica_config=ReplicaConfig(lambda x: x),
|
||||
deployer_job_id=ray.JobID.nil())
|
||||
|
||||
if version is not None:
|
||||
code_version = version
|
||||
|
|
Loading…
Add table
Reference in a new issue