Browse Source

#1654

fix bug
tags/v1.22.3.2^2
chenyifan01 4 years ago
parent
commit
31487439ae
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      routers/repo/cloudbrain.go

+ 8
- 1
routers/repo/cloudbrain.go View File

@@ -1059,6 +1059,7 @@ func SyncCloudbrainStatus() {
func HandleTaskWithNoDuration(ctx *context.Context) {
log.Info("HandleTaskWithNoDuration start")
count := 0
start := time.Now().Unix()
for {
cloudBrains, err := models.GetStoppedJobWithNoDurationJob()
if err != nil {
@@ -1075,13 +1076,19 @@ func HandleTaskWithNoDuration(ctx *context.Context) {
log.Info("HandleTaskWithNoTrainJobDuration:task less than 100")
break
}
if time.Now().Unix()-start > 600 {
log.Info("HandleTaskWithNoDuration : time out")
ctx.JSON(200, fmt.Sprintf("task stop for time out,count=%d", count))
return
}
}
log.Info("HandleTaskWithNoTrainJobDuration:count=%d", count)
ctx.JSON(200, "success")
ctx.JSON(200, fmt.Sprintf("success,count=%d", count))
}

func handleNoDurationTask(cloudBrains []*models.Cloudbrain) {
for _, task := range cloudBrains {
time.Sleep(time.Millisecond * 200)
log.Info("Handle job ,%+v", task)
if task.Type == models.TypeCloudBrainOne {
result, err := cloudbrain.GetJob(task.JobID)


Loading…
Cancel
Save