|
|
|
@@ -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) |
|
|
|
|