forked from JointCloud/pcm-coordinator
Merge pull request 'updated deployinstancestatus logics' (#280) from tzwang/pcm-coordinator:master into master
Former-commit-id: 4f7e622c54
This commit is contained in:
commit
775153d886
|
@ -42,26 +42,12 @@ func UpdateDeployTaskStatus(svc *svc.ServiceContext) {
|
|||
ins = list[i]
|
||||
}
|
||||
}
|
||||
updateDeployTaskStatus(svc, ins)
|
||||
}
|
||||
|
||||
func updateDeployTaskStatus(svc *svc.ServiceContext, ins *models.AiDeployInstanceTask) {
|
||||
list, err := svc.Scheduler.AiStorages.GetInstanceListByDeployTaskId(ins.Id)
|
||||
inslist, err := svc.Scheduler.AiStorages.GetInstanceListByDeployTaskId(ins.Id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for i := len(list) - 1; i >= 0; i-- {
|
||||
if list[i].Status == constants.Running || list[i].Status == constants.Stopped {
|
||||
list = append(list[:i], list[i+1:]...)
|
||||
}
|
||||
}
|
||||
|
||||
if len(list) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, instance := range list {
|
||||
for _, instance := range inslist {
|
||||
go UpdateDeployInstanceStatus(svc, instance, false)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue