fix task time bugs
Former-commit-id: ee55e0cc23f74218579a00960f599b60da5cdb04
This commit is contained in:
parent
99985ec130
commit
e2fc3b8b87
|
@ -1733,6 +1733,8 @@ PayloadCreateTrainJob{
|
||||||
AiTask {
|
AiTask {
|
||||||
Name string `json:"name,optional"`
|
Name string `json:"name,optional"`
|
||||||
status string `json:"status,optional"`
|
status string `json:"status,optional"`
|
||||||
|
Cluster string `json:"cluster,optional"`
|
||||||
|
Card string `json:"card,optional"`
|
||||||
TimeElapsed int32 `json:"elapsed,optional"`
|
TimeElapsed int32 `json:"elapsed,optional"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -98,7 +98,9 @@ func (l *PageListTaskLogic) updateAitaskStatus(tasks []*types.TaskModel, ch chan
|
||||||
|
|
||||||
start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local)
|
start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local)
|
||||||
end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local)
|
end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local)
|
||||||
var status = constants.Succeeded
|
|
||||||
|
var status string
|
||||||
|
var count int
|
||||||
for _, a := range aiTask {
|
for _, a := range aiTask {
|
||||||
s, _ := time.ParseInLocation(constants.Layout, a.StartTime, time.Local)
|
s, _ := time.ParseInLocation(constants.Layout, a.StartTime, time.Local)
|
||||||
e, _ := time.ParseInLocation(constants.Layout, a.EndTime, time.Local)
|
e, _ := time.ParseInLocation(constants.Layout, a.EndTime, time.Local)
|
||||||
|
@ -120,11 +122,22 @@ func (l *PageListTaskLogic) updateAitaskStatus(tasks []*types.TaskModel, ch chan
|
||||||
status = a.Status
|
status = a.Status
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if a.Status == constants.Completed {
|
||||||
|
count++
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if count == len(aiTask) {
|
||||||
|
status = constants.Succeeded
|
||||||
|
}
|
||||||
|
|
||||||
|
if status != "" {
|
||||||
task.Status = status
|
task.Status = status
|
||||||
task.StartTime = start.Format(constants.Layout)
|
task.StartTime = start.Format(constants.Layout)
|
||||||
task.EndTime = end.Format(constants.Layout)
|
task.EndTime = end.Format(constants.Layout)
|
||||||
|
}
|
||||||
|
|
||||||
tx = l.svcCtx.DbEngin.Table("task").Updates(task)
|
tx = l.svcCtx.DbEngin.Table("task").Updates(task)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
|
|
|
@ -208,7 +208,7 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster) (interfa
|
||||||
} else {
|
} else {
|
||||||
msg := fmt.Sprintf("clusterId: %v , submitted successfully, taskId: %v \n", s.ClusterId, s.TaskId)
|
msg := fmt.Sprintf("clusterId: %v , submitted successfully, taskId: %v \n", s.ClusterId, s.TaskId)
|
||||||
errmsg += msg
|
errmsg += msg
|
||||||
err := as.AiStorages.SaveAiTask(taskId, as.option, s.ClusterId, s.TaskId, constants.Succeeded, msg)
|
err := as.AiStorages.SaveAiTask(taskId, as.option, s.ClusterId, s.TaskId, constants.Saved, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("database add failed: " + err.Error())
|
return nil, errors.New("database add failed: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue