Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 3 years ago
parent
commit
04fffc69db
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      routers/repo/aisafety.go

+ 18
- 0
routers/repo/aisafety.go View File

@@ -296,6 +296,23 @@ func queryTaskStatusFromCloudbrainTwo(job *models.Cloudbrain) {

}

func updateCloudBrainOneJobTime(task *models.Cloudbrain) {
if task.TrainJobDuration == "" {
if task.Duration == 0 {
var duration int64
if task.Status == string(models.JobWaiting) {
duration = 0
} else if task.Status == string(models.JobRunning) {
duration = time.Now().Unix() - int64(task.CreatedUnix)
} else {
duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix)
}
task.Duration = duration
}
task.TrainJobDuration = models.ConvertDurationToStr(task.Duration)
}
}

func queryTaskStatusFromCloudbrain(job *models.Cloudbrain) {

log.Info("The task not finished,name=" + job.DisplayJobName)
@@ -312,6 +329,7 @@ func queryTaskStatusFromCloudbrain(job *models.Cloudbrain) {
taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{}))
job.Status = taskRes.TaskStatuses[0].State
}
updateCloudBrainOneJobTime(job)
log.Info("cloud brain one job status=" + job.Status)
if result.JobStatus.State != string(models.JobSucceeded) {
err = models.UpdateJob(job)


Loading…
Cancel
Save