| @@ -1065,16 +1065,29 @@ func SyncCloudbrainStatus() { | |||||
| func HandleTaskWithNoDuration(ctx *context.Context) { | func HandleTaskWithNoDuration(ctx *context.Context) { | ||||
| log.Info("HandleTaskWithNoDuration start") | log.Info("HandleTaskWithNoDuration start") | ||||
| cloudBrains, err := models.GetStoppedJobWithNoDurationJob() | |||||
| if err != nil { | |||||
| log.Error("HandleTaskWithNoTrainJobDuration failed:", err.Error()) | |||||
| return | |||||
| } | |||||
| if len(cloudBrains) == 0 { | |||||
| log.Info("HandleTaskWithNoTrainJobDuration:no task need handle") | |||||
| return | |||||
| count := 0 | |||||
| for { | |||||
| cloudBrains, err := models.GetStoppedJobWithNoDurationJob() | |||||
| if err != nil { | |||||
| log.Error("HandleTaskWithNoTrainJobDuration failed:", err.Error()) | |||||
| break | |||||
| } | |||||
| if len(cloudBrains) == 0 { | |||||
| log.Info("HandleTaskWithNoTrainJobDuration:no task need handle") | |||||
| break | |||||
| } | |||||
| handleNoDurationTask(cloudBrains) | |||||
| count += len(cloudBrains) | |||||
| if len(cloudBrains) < 100 { | |||||
| log.Info("HandleTaskWithNoTrainJobDuration:task less than 100") | |||||
| break | |||||
| } | |||||
| } | } | ||||
| log.Info("HandleTaskWithNoTrainJobDuration:count=%d", count) | |||||
| } | |||||
| func handleNoDurationTask(cloudBrains []*models.Cloudbrain) { | |||||
| for _, task := range cloudBrains { | for _, task := range cloudBrains { | ||||
| log.Info("Handle job ,%+v", task) | log.Info("Handle job ,%+v", task) | ||||
| if task.Type == models.TypeCloudBrainOne { | if task.Type == models.TypeCloudBrainOne { | ||||
| @@ -1181,8 +1194,6 @@ func HandleTaskWithNoDuration(ctx *context.Context) { | |||||
| log.Error("task.Type(%s) is error:%d", task.JobName, task.Type) | log.Error("task.Type(%s) is error:%d", task.JobName, task.Type) | ||||
| } | } | ||||
| } | } | ||||
| return | |||||
| } | } | ||||
| func CloudBrainBenchmarkIndex(ctx *context.Context) { | func CloudBrainBenchmarkIndex(ctx *context.Context) { | ||||