| @@ -723,24 +723,25 @@ type ErrorResult struct { | |||
| } | |||
| type GetTrainJobResult struct { | |||
| IsSuccess bool `json:"is_success"` | |||
| JobName string `json:"job_name"` | |||
| JobID int64 `json:"job_id"` | |||
| Description string `json:"job_desc"` | |||
| IntStatus int `json:"status"` | |||
| Status string | |||
| LongCreateTime int64 `json:"create_time"` | |||
| CreateTime string | |||
| Duration int64 `json:"duration"` //训练作业的运行时间,单位为毫秒 | |||
| VersionID int64 `json:"version_id"` | |||
| ResourceID string `json:"resource_id"` | |||
| VersionName string `json:"version_name"` | |||
| PreVersionID int64 `json:"pre_version_id"` | |||
| WorkServerNum int `json:"worker_server_num"` | |||
| AppUrl string `json:"app_url"` //训练作业的代码目录 | |||
| BootFileUrl string `json:"boot_file_url"` //训练作业的代码启动文件,需要在代码目录下 | |||
| Parameter []Parameter `json:"parameter"` | |||
| DataUrl string `json:"data_url"` //训练作业需要的数据集OBS路径URL | |||
| IsSuccess bool `json:"is_success"` | |||
| JobName string `json:"job_name"` | |||
| JobID int64 `json:"job_id"` | |||
| Description string `json:"job_desc"` | |||
| IntStatus int `json:"status"` | |||
| Status string | |||
| LongCreateTime int64 `json:"create_time"` | |||
| CreateTime string | |||
| Duration int64 `json:"duration"` //训练作业的运行时间,单位为毫秒 | |||
| TrainJobDuration string //训练作业的运行时间,格式为hh:mm:ss | |||
| VersionID int64 `json:"version_id"` | |||
| ResourceID string `json:"resource_id"` | |||
| VersionName string `json:"version_name"` | |||
| PreVersionID int64 `json:"pre_version_id"` | |||
| WorkServerNum int `json:"worker_server_num"` | |||
| AppUrl string `json:"app_url"` //训练作业的代码目录 | |||
| BootFileUrl string `json:"boot_file_url"` //训练作业的代码启动文件,需要在代码目录下 | |||
| Parameter []Parameter `json:"parameter"` | |||
| DataUrl string `json:"data_url"` //训练作业需要的数据集OBS路径URL | |||
| //DatasetID string `json:"dataset_id"` | |||
| //DataVersionID string `json:"dataset_version_id"` | |||
| //DataSource []DataSource `json:"data_source"` | |||
| @@ -516,6 +516,15 @@ func TrainJobIndex(ctx *context.Context) { | |||
| for i := range tasks { | |||
| TrainJobDetail, err := modelarts.GetTrainJob(tasks[i].Cloudbrain.JobID, strconv.FormatInt(tasks[i].Cloudbrain.VersionID, 10)) | |||
| if TrainJobDetail != nil { | |||
| TrainJobDetail.CreateTime = time.Unix(int64(TrainJobDetail.LongCreateTime/1000), 0).Format("2006-01-02 15:04:05") | |||
| if TrainJobDetail.Duration != 0 { | |||
| TrainJobDetail.TrainJobDuration = addZero(TrainJobDetail.Duration/3600000) + ":" + addZero(TrainJobDetail.Duration%3600000/60000) + ":" + addZero(TrainJobDetail.Duration%60000/1000) | |||
| } else { | |||
| TrainJobDetail.TrainJobDuration = "00:00:00" | |||
| } | |||
| } | |||
| if err != nil { | |||
| log.Error("GetJob(%s) failed:%v", tasks[i].Cloudbrain.JobID, err.Error()) | |||
| return | |||
| @@ -881,6 +890,12 @@ func TrainJobShow(ctx *context.Context) { | |||
| if result != nil { | |||
| result.CreateTime = time.Unix(int64(result.LongCreateTime/1000), 0).Format("2006-01-02 15:04:05") | |||
| if result.Duration != 0 { | |||
| result.TrainJobDuration = addZero(result.Duration/3600000) + ":" + addZero(result.Duration%3600000/60000) + ":" + addZero(result.Duration%60000/1000) | |||
| } else { | |||
| result.TrainJobDuration = "00:00:00" | |||
| } | |||
| result.Status = modelarts.TransTrainJobStatus(result.IntStatus) | |||
| result.DatasetName = attach.Name | |||
| } | |||
| @@ -900,6 +915,15 @@ func TrainJobShow(ctx *context.Context) { | |||
| ctx.HTML(http.StatusOK, tplModelArtsTrainJobShow) | |||
| } | |||
| func addZero(t int64) (m string) { | |||
| if t < 10 { | |||
| m = "0" + strconv.FormatInt(t, 10) | |||
| return m | |||
| } else { | |||
| return strconv.FormatInt(t, 10) | |||
| } | |||
| } | |||
| func TrainJobGetLog(ctx *context.Context) { | |||
| ctx.Data["PageIsTrainJob"] = true | |||
| @@ -55,7 +55,7 @@ | |||
| </tr> | |||
| <tr> | |||
| <td class="four wide"> {{.i18n.Tr "repo.modelarts.train_job.dura_time"}} </td> | |||
| <td>{{.result.Duration}}</td> | |||
| <td>{{.result.TrainJobDuration}}</td> | |||
| </tr> | |||
| <tr> | |||
| <td class="four wide"> {{.i18n.Tr "repo.modelarts.train_job.description"}} </td> | |||
| @@ -444,6 +444,7 @@ github.com/golang/protobuf/ptypes/timestamp | |||
| # github.com/golang/snappy v0.0.1 | |||
| github.com/golang/snappy | |||
| # github.com/gomodule/redigo v2.0.0+incompatible | |||
| ## explicit | |||
| github.com/gomodule/redigo/internal | |||
| github.com/gomodule/redigo/redis | |||
| # github.com/google/go-github/v24 v24.0.1 | |||