Merge pull request 'fix ai scheduler bugs' (#109) from tzwang/pcm-coordinator:master into master

Former-commit-id: 1a46411fbc446d3ec4ad0f9adab43ab310a12545
This commit is contained in:
tzwang 2024-04-11 19:33:11 +08:00
commit 76ca864472
5 changed files with 12 additions and 7 deletions

View File

@ -19,6 +19,7 @@ type (
ScheduleResult {
ClusterId string `json:"clusterId"`
TaskId string `json:"taskId"`
Strategy string `json:"strategy"`
Replica int32 `json:"replica"`
Msg string `json:"msg"`
}

View File

@ -55,6 +55,7 @@ func (l *ScheduleSubmitLogic) ScheduleSubmit(req *types.ScheduleReq) (resp *type
scheResult := &types.ScheduleResult{}
scheResult.ClusterId = r.ClusterId
scheResult.TaskId = r.TaskId
scheResult.Strategy = r.Strategy
scheResult.Replica = r.Replica
scheResult.Msg = r.Msg
resp.Results = append(resp.Results, scheResult)

View File

@ -43,6 +43,7 @@ type AiScheduler struct {
type AiResult struct {
TaskId string
ClusterId string
Strategy string
Replica int32
Msg string
}
@ -154,6 +155,7 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster) (interfa
result, _ := convertType(resp)
result.Replica = c.Replicas
result.ClusterId = c.ClusterId
result.Strategy = as.option.StrategyName
ch <- result
wg.Done()
@ -167,7 +169,7 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster) (interfa
errs = append(errs, e)
}
if len(errs) != len(clusters) {
if len(errs) == len(clusters) {
return nil, errors.New("submit task failed")
}

View File

@ -28,18 +28,18 @@ func InitAiClusterMap(octopusRpc octopusclient.Octopus, modelArtsRpc modelartsse
case OCTOPUS:
id, _ := strconv.ParseInt(c.Id, 10, 64)
octopus := storeLink.NewOctopusLink(octopusRpc, c.Nickname, id)
collectorMap[c.Nickname] = octopus
executorMap[c.Nickname] = octopus
collectorMap[c.Id] = octopus
executorMap[c.Id] = octopus
case MODELARTS:
id, _ := strconv.ParseInt(c.Id, 10, 64)
modelarts := storeLink.NewModelArtsLink(modelArtsRpc, modelArtsImgRpc, c.Nickname, id)
collectorMap[c.Nickname] = modelarts
executorMap[c.Nickname] = modelarts
collectorMap[c.Id] = modelarts
executorMap[c.Id] = modelarts
case SHUGUANGAI:
id, _ := strconv.ParseInt(c.Id, 10, 64)
sgai := storeLink.NewShuguangAi(aCRpc, c.Nickname, id)
collectorMap[c.Nickname] = sgai
executorMap[c.Nickname] = sgai
collectorMap[c.Id] = sgai
executorMap[c.Id] = sgai
}
}

View File

@ -5289,6 +5289,7 @@ type ScheduleResp struct {
type ScheduleResult struct {
ClusterId string `json:"clusterId"`
TaskId string `json:"taskId"`
Strategy string `json:"strategy"`
Replica int32 `json:"replica"`
Msg string `json:"msg"`
}