Merge pull request 'updated imageinfer api' (#230) from tzwang/pcm-coordinator:master into master
Former-commit-id: 5a85df1b43998220a7c1aaf5d135cddd7548f36e
This commit is contained in:
commit
ab9e7071f6
|
@ -217,6 +217,20 @@ func infer(opt *option.InferOption, clusters []*strategy.AssignedCluster, ts []s
|
|||
return nil, tx.Error
|
||||
|
||||
}
|
||||
|
||||
//no cluster available
|
||||
if len(cs) == 0 {
|
||||
for _, t := range aiTaskList {
|
||||
t.Status = constants.Failed
|
||||
err := svcCtx.Scheduler.AiStorages.UpdateAiTask(t)
|
||||
if err != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
}
|
||||
}
|
||||
svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "failed", "任务失败")
|
||||
return nil, errors.New("image infer task failed")
|
||||
}
|
||||
|
||||
//change cluster status
|
||||
if len(clusters) != len(cs) {
|
||||
var acs []*strategy.AssignedCluster
|
||||
|
@ -275,6 +289,7 @@ func infer(opt *option.InferOption, clusters []*strategy.AssignedCluster, ts []s
|
|||
})
|
||||
|
||||
// update succeeded cluster status
|
||||
var successStatusCount int
|
||||
for _, c := range cs {
|
||||
for _, t := range aiTaskList {
|
||||
if c.clusterId == strconv.Itoa(int(t.ClusterId)) {
|
||||
|
@ -283,9 +298,19 @@ func infer(opt *option.InferOption, clusters []*strategy.AssignedCluster, ts []s
|
|||
if err != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
}
|
||||
successStatusCount++
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(cs) == successStatusCount {
|
||||
svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "failed", "任务失败")
|
||||
} else {
|
||||
svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "completed", "任务完成")
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue