Skip to content

Commit

Permalink
fix: status code when deploy model error (#111)
Browse files Browse the repository at this point in the history
Because

- return error 500 when have internal error from triton server for deploying model 

This commit

- close #110
  • Loading branch information
Phelan164 authored Jun 26, 2022
1 parent 4bad3b3 commit 31d3f11
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ func (s *service) DeployModelInstance(modelInstanceId uuid.UUID) error {
}
// Load one ensemble model, which will also load all its dependent models
if _, err = s.triton.LoadModelRequest(tEnsembleModel.Name); err != nil {
if err = s.repository.UpdateModelInstance(modelInstanceId, datamodel.ModelInstance{
if err1 := s.repository.UpdateModelInstance(modelInstanceId, datamodel.ModelInstance{

State: datamodel.ModelInstanceState(modelPB.ModelInstance_STATE_ERROR),
}); err != nil {
return err
}); err1 != nil {
return err1
}
return err
}
Expand All @@ -99,10 +100,10 @@ func (s *service) UndeployModelInstance(modelInstanceId uuid.UUID) error {
// Unload all models composing the ensemble model
if _, err = s.triton.UnloadModelRequest(tm.Name); err != nil {
// If any models unloaded with error, we set the ensemble model status with ERROR and return
if err = s.repository.UpdateModelInstance(modelInstanceId, datamodel.ModelInstance{
if err1 := s.repository.UpdateModelInstance(modelInstanceId, datamodel.ModelInstance{
State: datamodel.ModelInstanceState(modelPB.ModelInstance_STATE_ERROR),
}); err != nil {
return err
}); err1 != nil {
return err1
}
return err
}
Expand Down

0 comments on commit 31d3f11

Please sign in to comment.