From 4c6d4dbd46b0360a4af8fc90858584ed3682b694 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 4 Aug 2022 15:47:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E8=84=91=E4=BA=8C=E7=9A=84=E5=88=86?= =?UTF-8?q?=E6=94=AF=E9=94=99=E8=AF=AF=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=94=B9=E6=88=90=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E7=9A=84=E6=8F=90=E7=A4=BA=E3=80=82=E6=99=BA=E7=AE=97?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E5=88=86=E6=94=AF=E5=A4=84=E7=90=86=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=EF=BC=88?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=86=85=E9=83=A8=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/repo/grampus.go | 3 +++ routers/repo/modelarts.go | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 36a27b088..fa709b6ea 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -840,6 +840,9 @@ func downloadZipCode(ctx *context.Context, codePath, branchName string) error { log.Error("GetBranchCommit failed:" + err.Error()) return err } + } else { + log.Error("the branch is not exist: " + branchName) + return fmt.Errorf("The branch does not exist.") } archivePath = path.Join(archivePath, grampus.CodeArchiveName) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 130d9f5ab..ec1a99c9d 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1147,7 +1147,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { log.Error("downloadCode failed, server timed out: %s (%v)", repo.FullName(), err) trainJobErrorNewDataPrepare(ctx, form) - ctx.RenderWithErr("Create task failed, server timed out", tplModelArtsTrainJobNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobNew, &form) return } @@ -1171,7 +1171,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) // if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) trainJobErrorNewDataPrepare(ctx, form) - ctx.RenderWithErr("Failed to uploadCodeToObs", tplModelArtsTrainJobNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobNew, &form) return } @@ -1426,7 +1426,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { log.Error("Failed git clone repo to local(!: %s (%v)", repo.FullName(), err) versionErrorDataPrepare(ctx, form) - ctx.RenderWithErr("Failed git clone repo to local!", tplModelArtsTrainJobVersionNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobVersionNew, &form) return } @@ -1451,7 +1451,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) versionErrorDataPrepare(ctx, form) - ctx.RenderWithErr("Failed to uploadCodeToObs", tplModelArtsTrainJobVersionNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsTrainJobVersionNew, &form) return } @@ -2090,7 +2090,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference if err := downloadCode(repo, codeLocalPath, branch_name); err != nil { log.Error("Create task failed, server timed out: %s (%v)", repo.FullName(), err) inferenceJobErrorNewDataPrepare(ctx, form) - ctx.RenderWithErr("Create task failed, server timed out", tplModelArtsInferenceJobNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsInferenceJobNew, &form) return } @@ -2112,7 +2112,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) inferenceJobErrorNewDataPrepare(ctx, form) - ctx.RenderWithErr("Failed to uploadCodeToObs", tplModelArtsInferenceJobNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.load_code_failed"), tplModelArtsInferenceJobNew, &form) return }