From 478ac98fd3d106d17681d83d87ef2bfefc345989 Mon Sep 17 00:00:00 2001 From: liuzx Date: Tue, 2 Nov 2021 18:53:00 +0800 Subject: [PATCH] fix bug 677 --- routers/repo/modelarts.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 4152ddf53..856826bd7 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -646,11 +646,18 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { log.Error("创建任务失败,任务名称已存在!: %s (%v)", repo.FullName(), err) trainJobNewDataPrepare(ctx) + attach, err := models.GetAttachmentByUUID(uuid) + if err != nil { + log.Error("GetAttachmentByUUID(%s) failed:%v", uuid, err.Error()) + return + } ctx.Data["bootFile"] = form.BootFile ctx.Data["uuid"] = form.Attachment + ctx.Data["datasetName"] = attach.Name ctx.Data["params"] = form.Params // ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) ctx.RenderWithErr("创建任务失败,任务名称已存在!", tplModelArtsTrainJobNew, &form) + // ctx.RenderWithErr(err, tplModelArtsTrainJobNew, &form) return } @@ -760,8 +767,14 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) if err != nil { log.Error("GenerateTrainJob failed:%v", err.Error()) trainJobNewDataPrepare(ctx) + attach, err := models.GetAttachmentByUUID(uuid) + if err != nil { + log.Error("GetAttachmentByUUID(%s) failed:%v", uuid, err.Error()) + return + } ctx.Data["bootFile"] = form.BootFile ctx.Data["uuid"] = form.Attachment + ctx.Data["datasetName"] = attach.Name ctx.Data["params"] = form.Params ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) return