Ejemplo n.º 1
0
 def GetDeployment(self, request, context=None):
     try:
         request.namespace = request.namespace or self.default_namespace
         deployment_pb = self.deployment_store.get(request.deployment_name,
                                                   request.namespace)
         if deployment_pb:
             return GetDeploymentResponse(status=Status.OK(),
                                          deployment=deployment_pb)
         else:
             return GetDeploymentResponse(status=Status.NOT_FOUND(
                 'Deployment "{}" in namespace "{}" not found'.format(
                     request.deployment_name, request.namespace)))
     except BentoMLException as e:
         logger.error("INTERNAL ERROR: %s", e)
         return GetDeploymentResponse(status=Status.INTERNAL(str(e)))
Ejemplo n.º 2
0
def create_yatai_service_mock():
    yatai_service_mock = Mock()
    yatai_service_mock.ApplyDeployment.return_value = ApplyDeploymentResponse()
    yatai_service_mock.DeleteDeployment.return_value = DeleteDeploymentResponse()
    yatai_service_mock.DescribeDeployment.return_value = DescribeDeploymentResponse()
    yatai_service_mock.GetDeployment.return_value = GetDeploymentResponse(
        status=Status.NOT_FOUND()
    )
    yatai_service_mock.ListDeployments.return_value = ListDeploymentsResponse()
    return yatai_service_mock