| @@ -5,7 +5,6 @@ import ( | |||||
| "code.gitea.io/gitea/services/cloudbrain/resource" | "code.gitea.io/gitea/services/cloudbrain/resource" | ||||
| "encoding/json" | "encoding/json" | ||||
| "errors" | "errors" | ||||
| "fmt" | |||||
| "io" | "io" | ||||
| "io/ioutil" | "io/ioutil" | ||||
| "net/http" | "net/http" | ||||
| @@ -320,24 +319,7 @@ func NotebookShow(ctx *context.Context) { | |||||
| if err == nil { | if err == nil { | ||||
| task.User = user | task.User = user | ||||
| } | } | ||||
| if modelarts.FlavorInfos == nil { | |||||
| json.Unmarshal([]byte(setting.FlavorInfos), &modelarts.FlavorInfos) | |||||
| } | |||||
| findSpec := false | |||||
| if modelarts.FlavorInfos != nil { | |||||
| ctx.Data["resource_spec"] = modelarts.FlavorInfos.FlavorInfo[0].Desc | |||||
| for _, f := range modelarts.FlavorInfos.FlavorInfo { | |||||
| if fmt.Sprint(f.Value) == task.FlavorCode { | |||||
| ctx.Data["resource_spec"] = f.Desc | |||||
| findSpec = true | |||||
| break | |||||
| } | |||||
| } | |||||
| } | |||||
| setShowSpecBySpecialPoolConfig(ctx, findSpec, task) | |||||
| prepareSpec4Show(ctx, task) | |||||
| if task.TrainJobDuration == "" { | if task.TrainJobDuration == "" { | ||||
| if task.Duration == 0 { | if task.Duration == 0 { | ||||
| var duration int64 | var duration int64 | ||||
| @@ -1781,7 +1763,6 @@ func TrainJobShow(ctx *context.Context) { | |||||
| for i, task := range VersionListTasks { | for i, task := range VersionListTasks { | ||||
| var parameters models.Parameters | var parameters models.Parameters | ||||
| err := json.Unmarshal([]byte(VersionListTasks[i].Parameters), ¶meters) | err := json.Unmarshal([]byte(VersionListTasks[i].Parameters), ¶meters) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("Failed to Unmarshal Parameters: %s (%v)", VersionListTasks[i].Parameters, err) | log.Error("Failed to Unmarshal Parameters: %s (%v)", VersionListTasks[i].Parameters, err) | ||||
| @@ -1802,6 +1783,14 @@ func TrainJobShow(ctx *context.Context) { | |||||
| datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) | datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) | ||||
| VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | ||||
| VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | ||||
| //add spec | |||||
| s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID) | |||||
| if err != nil { | |||||
| log.Error("TrainJobShow GetCloudbrainSpec error:" + err.Error()) | |||||
| continue | |||||
| } | |||||
| VersionListTasks[i].Cloudbrain.Spec = s | |||||
| } | } | ||||
| pager := context.NewPagination(VersionListCount, setting.UI.IssuePagingNum, page, 5) | pager := context.NewPagination(VersionListCount, setting.UI.IssuePagingNum, page, 5) | ||||
| @@ -2533,7 +2522,7 @@ func InferenceJobShow(ctx *context.Context) { | |||||
| } else { | } else { | ||||
| task.Parameters = "" | task.Parameters = "" | ||||
| } | } | ||||
| prepareSpec4Show(ctx, task) | |||||
| LabelName := strings.Fields(task.LabelName) | LabelName := strings.Fields(task.LabelName) | ||||
| ctx.Data["labelName"] = LabelName | ctx.Data["labelName"] = LabelName | ||||
| ctx.Data["jobID"] = jobID | ctx.Data["jobID"] = jobID | ||||