| @@ -2384,59 +2384,7 @@ func InferenceCloudBrainJobNew(ctx *context.Context) { | |||||
| } | } | ||||
| func InferenceCloudBrainJobShow(ctx *context.Context) { | func InferenceCloudBrainJobShow(ctx *context.Context) { | ||||
| err := cloudBrainNewDataPrepare(ctx) | |||||
| if err != nil { | |||||
| ctx.ServerError("get new train-job info failed", err) | |||||
| return | |||||
| } | |||||
| var jobID = ctx.Params(":jobid") | |||||
| task, err := models.GetCloudbrainByJobID(jobID) | |||||
| if err != nil { | |||||
| log.Error("GetInferenceTask(%s) failed:%v", jobID, err.Error()) | |||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainInferenceJobShow, nil) | |||||
| return | |||||
| } | |||||
| //将运行参数转化为epoch_size = 3, device_target = Ascend的格式 | |||||
| var parameters models.Parameters | |||||
| err = json.Unmarshal([]byte(task.Parameters), ¶meters) | |||||
| if err != nil { | |||||
| log.Error("Failed to Unmarshal Parameters: %s (%v)", task.Parameters, err) | |||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainInferenceJobShow, nil) | |||||
| return | |||||
| } | |||||
| if len(parameters.Parameter) > 0 { | |||||
| paramTemp := "" | |||||
| for _, Parameter := range parameters.Parameter { | |||||
| param := Parameter.Label + " = " + Parameter.Value + "; " | |||||
| paramTemp = paramTemp + param | |||||
| } | |||||
| task.Parameters = paramTemp[:len(paramTemp)-2] | |||||
| } else { | |||||
| task.Parameters = "" | |||||
| } | |||||
| LabelName := strings.Fields(task.LabelName) | |||||
| ctx.Data["labelName"] = LabelName | |||||
| ctx.Data["jobID"] = jobID | |||||
| ctx.Data["jobName"] = task.JobName | |||||
| ctx.Data["displayJobName"] = task.DisplayJobName | |||||
| ctx.Data["task"] = task | |||||
| ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) | |||||
| tempUids := []int64{} | |||||
| tempUids = append(tempUids, task.UserID) | |||||
| JobCreater, err := models.GetUserNamesByIDs(tempUids) | |||||
| if err != nil { | |||||
| log.Error("GetUserNamesByIDs (WhitelistUserIDs): %v", err) | |||||
| } | |||||
| ctx.Data["userName"] = JobCreater[0] | |||||
| ctx.HTML(http.StatusOK, tplCloudBrainInferenceJobShow) | |||||
| cloudBrainShow(ctx, tplCloudBrainInferenceJobShow, models.JobTypeTrain) | |||||
| } | } | ||||
| func DownloadInferenceResultFile(ctx *context.Context) { | func DownloadInferenceResultFile(ctx *context.Context) { | ||||