|
|
|
@@ -545,7 +545,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
|
|
|
|
keyword := strings.Trim(ctx.Query("q"), " ") |
|
|
|
|
|
|
|
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
ciTasks, count, err := models.CloudbrainAll(&models.CloudbrainsOptions{ |
|
|
|
ListOptions: models.ListOptions{ |
|
|
|
Page: page, |
|
|
|
PageSize: pageSize, |
|
|
|
@@ -558,12 +558,12 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
JobStatus: jobStatuses, |
|
|
|
JobTypes: jobTypes, |
|
|
|
NeedRepoInfo: true, |
|
|
|
// IsLatestVersion: modelarts.IsLatestVersion, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Get job failed:", err) |
|
|
|
return |
|
|
|
} |
|
|
|
nilTime := time.Time{} |
|
|
|
tasks := []models.TaskDetail{} |
|
|
|
for i, task := range ciTasks { |
|
|
|
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource |
|
|
|
@@ -592,6 +592,12 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
if ciTasks[i].Cloudbrain.Type == models.TypeCloudBrainTwo || (ciTasks[i].Cloudbrain.Type == models.TypeCloudBrainOne && ciTasks[i].Cloudbrain.JobType == "TRAIN") { |
|
|
|
taskDetail.JobID = ciTasks[i].Cloudbrain.JobID |
|
|
|
} |
|
|
|
|
|
|
|
if ciTasks[i].Cloudbrain.DeletedAt != nilTime { |
|
|
|
taskDetail.IsDelete = true |
|
|
|
} else { |
|
|
|
taskDetail.IsDelete = false |
|
|
|
} |
|
|
|
tasks = append(tasks, taskDetail) |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1029,20 +1035,20 @@ func getCloudbrainFileName(baseName string) string { |
|
|
|
} |
|
|
|
func allCloudbrainHeader(ctx *context.Context) map[string]string { |
|
|
|
|
|
|
|
return map[string]string{"A1": ctx.Tr("repo.cloudbrain_task"), "B1": ctx.Tr("repo.cloudbrain_task_type"), "C1": ctx.Tr("repo.modelarts.status"), |
|
|
|
"D1": ctx.Tr("repo.modelarts.createtime"), "E1": ctx.Tr("repo.modelarts.train_job.wait_time"), "F1": ctx.Tr("repo.modelarts.train_job.dura_time"), |
|
|
|
"G1": ctx.Tr("repo.modelarts.train_job.start_time"), |
|
|
|
"H1": ctx.Tr("repo.modelarts.train_job.end_time"), "I1": ctx.Tr("repo.modelarts.computing_resources"), |
|
|
|
"J1": ctx.Tr("repo.cloudbrain_creator"), "K1": ctx.Tr("repo.repo_name"), "L1": ctx.Tr("repo.cloudbrain_task_name")} |
|
|
|
return map[string]string{"A1": ctx.Tr("repo.cloudbrain_type"), "B1": ctx.Tr("repo.cloudbrain_task"), "C1": ctx.Tr("repo.modelarts.status"), "D1": ctx.Tr("repo.cloudbrain_task_type"), |
|
|
|
"E1": ctx.Tr("repo.modelarts.createtime"), "F1": ctx.Tr("repo.modelarts.train_job.wait_time"), "G1": ctx.Tr("repo.modelarts.train_job.dura_time"), |
|
|
|
"H1": ctx.Tr("repo.modelarts.train_job.start_time"), |
|
|
|
"I1": ctx.Tr("repo.modelarts.train_job.end_time"), "J1": ctx.Tr("repo.modelarts.computing_resources"), |
|
|
|
"K1": ctx.Tr("repo.cloudbrain_creator"), "L1": ctx.Tr("repo.repo_name"), "M1": ctx.Tr("repo.cloudbrain_task_name"), "N1": ctx.Tr("repo.modelarts.deletetime")} |
|
|
|
|
|
|
|
} |
|
|
|
func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { |
|
|
|
return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): rs.JobType, getCellName("C", row): rs.Status, |
|
|
|
getCellName("D", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("E", row): getBrainWaitTime(rs), |
|
|
|
getCellName("F", row): rs.TrainJobDuration, getCellName("G", row): getBrainStartTime(rs), |
|
|
|
getCellName("H", row): getBrainEndTime(rs), |
|
|
|
getCellName("I", row): rs.ComputeResource, getCellName("J", row): rs.Name, getCellName("K", row): getBrainRepo(rs), |
|
|
|
getCellName("L", row): rs.JobName, |
|
|
|
return map[string]string{getCellName("A", row): getCloudbrainType(rs), getCellName("B", row): rs.DisplayJobName, getCellName("C", row): rs.Status, getCellName("D", row): rs.JobType, |
|
|
|
getCellName("E", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("F", row): getBrainWaitTime(rs), |
|
|
|
getCellName("G", row): rs.TrainJobDuration, getCellName("H", row): getBrainStartTime(rs), |
|
|
|
getCellName("I", row): getBrainEndTime(rs), |
|
|
|
getCellName("J", row): rs.ComputeResource, getCellName("K", row): rs.Name, getCellName("L", row): getBrainRepo(rs), |
|
|
|
getCellName("M", row): rs.JobName, getCellName("N", row): getBrainDeleteTime(rs), |
|
|
|
} |
|
|
|
} |
|
|
|
func getBrainRepo(rs *models.CloudbrainInfo) string { |
|
|
|
@@ -1077,3 +1083,23 @@ func getBrainWaitTime(rs *models.CloudbrainInfo) string { |
|
|
|
return models.ConvertDurationToStr(int64(waitTime)) |
|
|
|
} |
|
|
|
} |
|
|
|
func getCloudbrainType(rs *models.CloudbrainInfo) string { |
|
|
|
if rs.Cloudbrain.Type == models.TypeCloudBrainOne { |
|
|
|
return "云脑Ⅰ" |
|
|
|
} else if rs.Cloudbrain.Type == models.TypeCloudBrainTwo { |
|
|
|
return "云脑Ⅱ" |
|
|
|
} else if rs.Cloudbrain.Type == models.TypeIntelligentNet { |
|
|
|
return "智算网络" |
|
|
|
} else { |
|
|
|
return "未知支撑算力" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func getBrainDeleteTime(rs *models.CloudbrainInfo) string { |
|
|
|
nilTime := time.Time{} |
|
|
|
if rs.Cloudbrain.DeletedAt != nilTime { |
|
|
|
return rs.Cloudbrain.DeletedAt.Format("2006-01-02 15:04:05") |
|
|
|
} else { |
|
|
|
return "" |
|
|
|
} |
|
|
|
} |