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