Merge pull request 'fix deployinstance bugs' (#277) from tzwang/pcm-coordinator:master into master

This commit is contained in:
tzwang 2024-07-27 16:17:06 +08:00
commit dddbe7cd18
1 changed files with 18 additions and 0 deletions

View File

@ -45,8 +45,14 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe
case storeLink.TYPE_OCTOPUS: case storeLink.TYPE_OCTOPUS:
switch ins.Status { switch ins.Status {
case "running": case "running":
if instance.Status == constants.Running {
return
}
instance.Status = constants.Running instance.Status = constants.Running
case "stopped": case "stopped":
if instance.Status == constants.Stopped {
return
}
instance.Status = constants.Stopped instance.Status = constants.Stopped
default: default:
instance.Status = ins.Status instance.Status = ins.Status
@ -54,8 +60,14 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe
case storeLink.TYPE_MODELARTS: case storeLink.TYPE_MODELARTS:
switch ins.Status { switch ins.Status {
case "running": case "running":
if instance.Status == constants.Running {
return
}
instance.Status = constants.Running instance.Status = constants.Running
case "stopped": case "stopped":
if instance.Status == constants.Stopped {
return
}
instance.Status = constants.Stopped instance.Status = constants.Stopped
default: default:
instance.Status = ins.Status instance.Status = ins.Status
@ -63,8 +75,14 @@ func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInfe
case storeLink.TYPE_SHUGUANGAI: case storeLink.TYPE_SHUGUANGAI:
switch ins.Status { switch ins.Status {
case "Running": case "Running":
if instance.Status == constants.Running {
return
}
instance.Status = constants.Running instance.Status = constants.Running
case "Terminated": case "Terminated":
if instance.Status == constants.Stopped {
return
}
instance.Status = constants.Stopped instance.Status = constants.Stopped
default: default:
instance.Status = ins.Status instance.Status = ins.Status