Skip to content

Commit

Permalink
FIx deployment.status is running eventhough deployment is failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Arief Rahmansyah committed Oct 20, 2023
1 parent 1b9eee4 commit 619c836
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions api/queue/work/model_service_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ func (depl *ModelServiceDeployment) Deploy(job *queue.Job) error {
}

defer func() {
deploymentCounter.WithLabelValues(model.Project.Name, model.Name, fmt.Sprint(endpoint.Status), fmt.Sprint(isRedeployment)).Inc()
deploymentCounter.WithLabelValues(model.Project.Name, model.Name, fmt.Sprint(deployment.Status), fmt.Sprint(isRedeployment)).Inc()

// record the deployment result
deployment.Status = endpoint.Status
deployment.Error = endpoint.Message
deployment.UpdatedAt = time.Now()
if _, err := depl.DeploymentStorage.Save(deployment); err != nil {
log.Warnf("unable to update deployment history", err)
Expand All @@ -125,19 +123,26 @@ func (depl *ModelServiceDeployment) Deploy(job *queue.Job) error {

modelOpt, err := depl.generateModelOptions(ctx, model, version)
if err != nil {
deployment.Status = models.EndpointFailed
deployment.Error = err.Error()
endpoint.Message = err.Error()
return err
}

modelService := models.NewService(model, version, modelOpt, endpoint)
ctl, ok := depl.ClusterControllers[endpoint.EnvironmentName]
if !ok {
deployment.Status = models.EndpointFailed
deployment.Error = err.Error()
endpoint.Message = err.Error()
return fmt.Errorf("unable to find cluster controller for environment %s", endpoint.EnvironmentName)
}

svc, err := ctl.Deploy(ctx, modelService)
if err != nil {
log.Errorf("unable to deploy version endpoint for model: %s, version: %s, reason: %v", model.Name, version.ID, err)
deployment.Status = models.EndpointFailed
deployment.Error = err.Error()
endpoint.Message = err.Error()
return err
}
Expand All @@ -154,6 +159,8 @@ func (depl *ModelServiceDeployment) Deploy(job *queue.Job) error {
endpoint.InferenceServiceName = svc.CurrentIsvcName
endpoint.Message = "" // reset message

deployment.Status = endpoint.Status

return nil
}

Expand Down
3 changes: 2 additions & 1 deletion ui/src/pages/version/HistoryDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const RevisionPanel = ({ deployments, deploymentsLoaded, endpoint }) => {

const deployedRevision = orderedDeployments.find(
(deployment) =>
deployment.status === "running" || deployment.status === "serving"
(deployment.status === "running" || deployment.status === "serving") &&
deployment.error === ""
) || { id: null };

const canBeExpanded = (deployment) => {
Expand Down

0 comments on commit 619c836

Please sign in to comment.