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