Browse Source

#1654

fix bug
tags/v1.22.3.2^2
chenyifan01 3 years ago
parent
commit
82787ddc2e
1 changed files with 21 additions and 10 deletions
  1. +21
    -10
      routers/repo/cloudbrain.go

+ 21
- 10
routers/repo/cloudbrain.go View File

@@ -1065,16 +1065,29 @@ func SyncCloudbrainStatus() {

func HandleTaskWithNoDuration(ctx *context.Context) {
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 {
log.Info("Handle job ,%+v", task)
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)
}
}

return
}

func CloudBrainBenchmarkIndex(ctx *context.Context) {


Loading…
Cancel
Save