fix instancelist bugs
This commit is contained in:
parent
24c8de7251
commit
27d76bbaab
|
@ -9,7 +9,6 @@ import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeployInstanceListLogic struct {
|
type DeployInstanceListLogic struct {
|
||||||
|
@ -72,18 +71,6 @@ func (l *DeployInstanceListLogic) DeployInstanceList(req *types.DeployInstanceLi
|
||||||
|
|
||||||
if len(list) != 0 {
|
if len(list) != 0 {
|
||||||
go status.UpdateDeployInstanceStatusBatch(l.svcCtx, list, true)
|
go status.UpdateDeployInstanceStatusBatch(l.svcCtx, list, true)
|
||||||
|
|
||||||
ins := list[0]
|
|
||||||
for i := range list {
|
|
||||||
uTime, _ := time.Parse(time.RFC3339, ins.UpdateTime)
|
|
||||||
latest, _ := time.Parse(time.RFC3339, list[i].UpdateTime)
|
|
||||||
if latest.After(uTime) {
|
|
||||||
ins = list[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
go status.UpdateDeployInstanceStatus(l.svcCtx, ins, true, nil)
|
|
||||||
go status.UpdateDeployTaskStatus(l.svcCtx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.List = &deployTasks
|
resp.List = &deployTasks
|
||||||
|
|
|
@ -45,7 +45,11 @@ func (l *StartDeployInstanceListLogic) StartDeployInstanceList(req *types.StartD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go status.UpdateDeployInstanceStatus(l.svcCtx, ins, true, nil)
|
ins.Status = "Updating"
|
||||||
|
err = l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,11 @@ func (l *StopDeployInstanceLogic) StopDeployInstance(req *types.StopDeployInstan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go status.UpdateDeployInstanceStatus(l.svcCtx, ins, true, nil)
|
ins.Status = "Updating"
|
||||||
|
err = l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,6 +483,17 @@ func (s *AiStorage) UpdateDeployTaskById(id int64) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
list, err := s.GetInstanceListByDeployTaskId(id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, instance := range list {
|
||||||
|
instance.Status = "Updating"
|
||||||
|
err := s.UpdateInferDeployInstance(instance, true)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue