def test_proto(self, status): serve_application_status_info = ApplicationStatusInfo( status=status, message="context about status", deployment_timestamp=time.time(), ) serialized_proto = serve_application_status_info.to_proto( ).SerializeToString() deserialized_proto = ApplicationStatusInfoProto.FromString( serialized_proto) reconstructed_info = ApplicationStatusInfo.from_proto( deserialized_proto) assert serve_application_status_info == reconstructed_info
async def get_serve_status(self) -> bytes: serve_app_status = ApplicationStatus.RUNNING serve_app_message = "" deployment_timestamp = self.deployment_timestamp if self.config_deployment_request_ref: finished, pending = ray.wait([self.config_deployment_request_ref], timeout=0) if pending: serve_app_status = ApplicationStatus.DEPLOYING else: try: await finished[0] except RayTaskError: serve_app_status = ApplicationStatus.DEPLOY_FAILED serve_app_message = f"Deployment failed:\n{traceback.format_exc()}" app_status = ApplicationStatusInfo(serve_app_status, serve_app_message, deployment_timestamp) deployment_statuses = self.deployment_state_manager.get_deployment_statuses( ) status_info = StatusOverview( app_status=app_status, deployment_statuses=deployment_statuses, ) return status_info.to_proto().SerializeToString()
def test_proto(self, application_status): status_info = StatusOverview( app_status=ApplicationStatusInfo( status=application_status, message="context about this status", deployment_timestamp=time.time(), ), deployment_statuses=[ DeploymentStatusInfo( name="name1", status=DeploymentStatus.UPDATING, message="deployment updating", ), DeploymentStatusInfo(name="name2", status=DeploymentStatus.HEALTHY, message=""), DeploymentStatusInfo( name="name3", status=DeploymentStatus.UNHEALTHY, message="this deployment is unhealthy", ), ], ) serialized_proto = status_info.to_proto().SerializeToString() deserialized_proto = StatusOverviewProto.FromString(serialized_proto) reconstructed_info = StatusOverview.from_proto(deserialized_proto) assert status_info == reconstructed_info
def get_valid_serve_status_schema(self): return StatusOverview( app_status=ApplicationStatusInfo( status="DEPLOYING", message="", deployment_timestamp=time.time(), ), deployment_statuses=[ DeploymentStatusInfo( name="deployment_1", status="HEALTHY", message="", ), DeploymentStatusInfo( name="deployment_2", status="UNHEALTHY", message="this deployment is deeply unhealthy", ), ], )
def test_application_status_required(self): with pytest.raises(TypeError): ApplicationStatusInfo(message="context about status", deployment_timestamp=time.time())
def get_valid_serve_application_status_info(self): return ApplicationStatusInfo( status=ApplicationStatus.RUNNING, message="", deployment_timestamp=time.time(), )