From 104fe3ff2acc1f68207be24bc0ed5754f87c067d Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 5 Aug 2022 11:57:03 +0800 Subject: [PATCH 1/3] check bootfile --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + routers/repo/cloudbrain.go | 26 ++++++++++++++++++++++ routers/repo/grampus.go | 16 ++++++++++++++ routers/repo/modelarts.go | 48 ++++++++++++++++++++++++++++++----------- 5 files changed, 80 insertions(+), 12 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d1e61d242..c4b59f501 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1073,6 +1073,7 @@ cloudbrain_operate = Operate cloudbrain_status_createtime = Status/Createtime cloudbrain_status_runtime = Running Time cloudbrain_jobname_err=Name must start with a lowercase letter or number,can include lowercase letter,number,_ and -,can not end with _, and can be up to 36 characters long. +cloudbrain_bootfile_err=The bootfile does not exist in the repository cloudbrain_query_fail=Failed to query cloudbrain information. cloudbrain.mirror_tag = Mirror Tag cloudbrain.mirror_description = Mirror Description diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index a39118c0a..8006bf1fe 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1076,6 +1076,7 @@ cloudbrain_operate=操作 cloudbrain_status_createtime=状态/创建时间 cloudbrain_status_runtime = 运行时长 cloudbrain_jobname_err=只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。 +cloudbrain_bootfile_err=仓库中不存在启动文件 cloudbrain_query_fail=查询云脑任务失败。 cloudbrain.mirror_tag = 镜像标签 cloudbrain.mirror_description = 镜像描述 diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 76bf9b076..b84797361 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -239,6 +239,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath resourceSpecId := form.ResourceSpecId branchName := form.BranchName + bootFile := strings.TrimSpace(form.BootFile) repo := ctx.Repo.Repository tpl := tplCloudBrainNew @@ -269,6 +270,14 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) + return + } + if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeTrain) { log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) @@ -413,6 +422,7 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath resourceSpecId := form.ResourceSpecId branchName := form.BranchName + bootFile := strings.TrimSpace(form.BootFile) labelName := form.LabelName repo := ctx.Repo.Repository @@ -450,6 +460,14 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) + return + } + count, err := models.GetCloudbrainCountByUserID(ctx.User.ID, jobType) if err != nil { log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"]) @@ -527,6 +545,14 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra } /** + 获取启动文件的网页地址 +*/ +func getBootfileUrl(repo *models.Repository, branchName string, bootFile string) string { + url := setting.AppURL + repo.OwnerName + "/" + repo.Name + "/src/branch/" + branchName + "/" + bootFile + return url +} + +/** 检查用户传输的参数是否符合专属资源池 */ func checkCloudBrainSpecialPool(ctx *context.Context, jobType string, queue string, resourceSpecId int) string { diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 060b020e2..c6fe3789a 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -215,6 +215,14 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) + grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobGPUNew, &form) + return + } + errStr := checkSpecialPool(ctx, "GPU") if errStr != "" { grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) @@ -399,6 +407,14 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) + grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobNPUNew, &form) + return + } + errStr := checkSpecialPool(ctx, "NPU") if errStr != "" { grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 948a0e751..632f9cff0 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1089,7 +1089,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath + VersionOutputPath + "/" logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/" // dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" - branch_name := form.BranchName + branchName := form.BranchName isLatestVersion := modelarts.IsLatestVersion FlavorName := form.FlavorName VersionCount := modelarts.VersionCount @@ -1117,6 +1117,14 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err) + trainJobErrorNewDataPrepare(ctx, form) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobNew, &form) + return + } + errStr := checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) if errStr != "" { trainJobErrorNewDataPrepare(ctx, form) @@ -1148,9 +1156,9 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) } gitRepo, _ := git.OpenRepository(repo.RepoPath()) - commitID, _ := gitRepo.GetBranchCommitID(branch_name) + commitID, _ := gitRepo.GetBranchCommitID(branchName) - if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { + if err := downloadCode(repo, codeLocalPath, branchName); err != nil { log.Error("downloadCode failed, server timed out: %s (%v)", repo.FullName(), err) trainJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobNew, &form) @@ -1292,7 +1300,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) Parameters: param, CommitID: commitID, IsLatestVersion: isLatestVersion, - BranchName: branch_name, + BranchName: branchName, Params: form.Params, FlavorName: FlavorName, EngineName: EngineName, @@ -1394,7 +1402,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath + VersionOutputPath + "/" logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/" // dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" - branch_name := form.BranchName + branchName := form.BranchName PreVersionName := form.VersionName FlavorName := form.FlavorName EngineName := form.EngineName @@ -1414,6 +1422,14 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err) + versionErrorDataPrepare(ctx, form) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobVersionNew, &form) + return + } + errStr := checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) if errStr != "" { versionErrorDataPrepare(ctx, form) @@ -1428,8 +1444,8 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ } gitRepo, _ := git.OpenRepository(repo.RepoPath()) - commitID, _ := gitRepo.GetBranchCommitID(branch_name) - if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { + commitID, _ := gitRepo.GetBranchCommitID(branchName) + if err := downloadCode(repo, codeLocalPath, branchName); err != nil { log.Error("Failed git clone repo to local(!: %s (%v)", repo.FullName(), err) versionErrorDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobVersionNew, &form) @@ -1582,7 +1598,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ Parameters: param, PreVersionId: task.VersionID, CommitID: commitID, - BranchName: branch_name, + BranchName: branchName, FlavorName: FlavorName, EngineName: EngineName, PreVersionName: PreVersionName, @@ -2025,7 +2041,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference resultObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.ResultPath + VersionOutputPath + "/" logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/" dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" - branch_name := form.BranchName + branchName := form.BranchName FlavorName := form.FlavorName EngineName := form.EngineName LabelName := form.LabelName @@ -2060,6 +2076,14 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference return } + resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) + if err != nil || resp.StatusCode != 200 { + log.Error("Get bootfile error:", err) + inferenceJobErrorNewDataPrepare(ctx, form) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsInferenceJobNew, &form) + return + } + //Determine whether the task name of the task in the project is duplicated tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, string(models.JobTypeInference), displayJobName) if err == nil { @@ -2092,9 +2116,9 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference } gitRepo, _ := git.OpenRepository(repo.RepoPath()) - commitID, _ := gitRepo.GetBranchCommitID(branch_name) + commitID, _ := gitRepo.GetBranchCommitID(branchName) - if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { + if err := downloadCode(repo, codeLocalPath, branchName); err != nil { log.Error("Create task failed, server timed out: %s (%v)", repo.FullName(), err) inferenceJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsInferenceJobNew, &form) @@ -2178,7 +2202,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference Uuid: uuid, Parameters: param, //modelarts train parameters CommitID: commitID, - BranchName: branch_name, + BranchName: branchName, Params: form.Params, FlavorName: FlavorName, EngineName: EngineName, From ab315042b88eacfbf690296612ba8f2a1963490b Mon Sep 17 00:00:00 2001 From: liuzx Date: Tue, 9 Aug 2022 14:45:00 +0800 Subject: [PATCH 2/3] checkout bootfile --- routers/repo/cloudbrain.go | 27 +++++++++------------------ routers/repo/grampus.go | 8 ++++---- routers/repo/modelarts.go | 12 ++++++------ 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index b84797361..066008e49 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -270,14 +270,6 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { - log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) - cloudBrainNewDataPrepare(ctx) - ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) - return - } - if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeTrain) { log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) @@ -314,6 +306,13 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { command := cloudbrain.GetCloudbrainDebugCommand() if jobType == string(models.JobTypeTrain) { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { + log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) + return + } tpl = tplCloudBrainTrainJobNew commandTrain, err := getTrainJobCommand(form) if err != nil { @@ -460,8 +459,8 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) @@ -545,14 +544,6 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra } /** - 获取启动文件的网页地址 -*/ -func getBootfileUrl(repo *models.Repository, branchName string, bootFile string) string { - url := setting.AppURL + repo.OwnerName + "/" + repo.Name + "/src/branch/" + branchName + "/" + bootFile - return url -} - -/** 检查用户传输的参数是否符合专属资源池 */ func checkCloudBrainSpecialPool(ctx *context.Context, jobType string, queue string, resourceSpecId int) string { diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index c6fe3789a..c31143a33 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -215,8 +215,8 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobGPUNew, &form) @@ -407,8 +407,8 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobNPUNew, &form) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 632f9cff0..a0dfa6d05 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1117,8 +1117,8 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err) trainJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobNew, &form) @@ -1422,8 +1422,8 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err) versionErrorDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobVersionNew, &form) @@ -2076,8 +2076,8 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference return } - resp, err := http.Get(getBootfileUrl(repo, branchName, bootFile)) - if err != nil || resp.StatusCode != 200 { + bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExict { log.Error("Get bootfile error:", err) inferenceJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsInferenceJobNew, &form) From e8f0f987ca5d1461ba420d2503b083e5490fcf18 Mon Sep 17 00:00:00 2001 From: liuzx Date: Tue, 9 Aug 2022 14:57:25 +0800 Subject: [PATCH 3/3] checkout bootfile --- routers/repo/cloudbrain.go | 8 ++++---- routers/repo/grampus.go | 8 ++++---- routers/repo/modelarts.go | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 066008e49..1f33f7023 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -306,8 +306,8 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { command := cloudbrain.GetCloudbrainDebugCommand() if jobType == string(models.JobTypeTrain) { - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) @@ -459,8 +459,8 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index c31143a33..133f270f2 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -215,8 +215,8 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobGPUNew, &form) @@ -407,8 +407,8 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobNPUNew, &form) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index a0dfa6d05..92236d235 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1117,8 +1117,8 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err) trainJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobNew, &form) @@ -1422,8 +1422,8 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err) versionErrorDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobVersionNew, &form) @@ -2076,8 +2076,8 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference return } - bootFileExict, err := ctx.Repo.FileExists(bootFile, branchName) - if err != nil || !bootFileExict { + bootFileExist, err := ctx.Repo.FileExists(bootFile, branchName) + if err != nil || !bootFileExist { log.Error("Get bootfile error:", err) inferenceJobErrorNewDataPrepare(ctx, form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsInferenceJobNew, &form)