| @@ -264,6 +264,7 @@ func queryTaskStatusFromCloudbrainTwo(job *models.Cloudbrain) { | |||||
| log.Info("query train job error." + err.Error()) | log.Info("query train job error." + err.Error()) | ||||
| return | return | ||||
| } | } | ||||
| job.Status = modelarts.TransTrainJobStatus(result.IntStatus) | job.Status = modelarts.TransTrainJobStatus(result.IntStatus) | ||||
| job.Duration = result.Duration / 1000 | job.Duration = result.Duration / 1000 | ||||
| job.TrainJobDuration = result.TrainJobDuration | job.TrainJobDuration = result.TrainJobDuration | ||||
| @@ -296,23 +297,6 @@ 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) { | func queryTaskStatusFromCloudbrain(job *models.Cloudbrain) { | ||||
| log.Info("The task not finished,name=" + job.DisplayJobName) | log.Info("The task not finished,name=" + job.DisplayJobName) | ||||
| @@ -329,7 +313,8 @@ func queryTaskStatusFromCloudbrain(job *models.Cloudbrain) { | |||||
| taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | ||||
| job.Status = taskRes.TaskStatuses[0].State | job.Status = taskRes.TaskStatuses[0].State | ||||
| } | } | ||||
| updateCloudBrainOneJobTime(job) | |||||
| models.ParseAndSetDurationFromCloudBrainOne(result, job) | |||||
| //updateCloudBrainOneJobTime(job) | |||||
| log.Info("cloud brain one job status=" + job.Status) | log.Info("cloud brain one job status=" + job.Status) | ||||
| if result.JobStatus.State != string(models.JobSucceeded) { | if result.JobStatus.State != string(models.JobSucceeded) { | ||||
| err = models.UpdateJob(job) | err = models.UpdateJob(job) | ||||