| @@ -270,14 +270,6 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| return | 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) { | if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeTrain) { | ||||
| log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) | log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) | ||||
| cloudBrainNewDataPrepare(ctx) | cloudBrainNewDataPrepare(ctx) | ||||
| @@ -314,6 +306,13 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| command := cloudbrain.GetCloudbrainDebugCommand() | command := cloudbrain.GetCloudbrainDebugCommand() | ||||
| if jobType == string(models.JobTypeTrain) { | 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 | tpl = tplCloudBrainTrainJobNew | ||||
| commandTrain, err := getTrainJobCommand(form) | commandTrain, err := getTrainJobCommand(form) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -460,8 +459,8 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra | |||||
| return | 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"]) | log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) | ||||
| cloudBrainNewDataPrepare(ctx) | cloudBrainNewDataPrepare(ctx) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tpl, &form) | ||||
| @@ -544,14 +543,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 | |||||
| } | |||||
| /** | /** | ||||
| 检查用户传输的参数是否符合专属资源池 | 检查用户传输的参数是否符合专属资源池 | ||||
| */ | */ | ||||
| @@ -215,8 +215,8 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| return | 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"]) | log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobGPUNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobGPUNew, &form) | ||||
| @@ -407,8 +407,8 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| return | 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"]) | log.Error("Get bootfile error:", err, ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplGrampusTrainJobNPUNew, &form) | ||||
| @@ -1117,8 +1117,8 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| return | 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) | log.Error("Get bootfile error:", err) | ||||
| trainJobErrorNewDataPrepare(ctx, form) | trainJobErrorNewDataPrepare(ctx, form) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobNew, &form) | ||||
| @@ -1422,8 +1422,8 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ | |||||
| return | 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) | log.Error("Get bootfile error:", err) | ||||
| versionErrorDataPrepare(ctx, form) | versionErrorDataPrepare(ctx, form) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobVersionNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsTrainJobVersionNew, &form) | ||||
| @@ -2076,8 +2076,8 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference | |||||
| return | 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) | log.Error("Get bootfile error:", err) | ||||
| inferenceJobErrorNewDataPrepare(ctx, form) | inferenceJobErrorNewDataPrepare(ctx, form) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsInferenceJobNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_bootfile_err"), tplModelArtsInferenceJobNew, &form) | ||||