|
|
|
@@ -1140,22 +1140,16 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ |
|
|
|
_, err = ioutil.ReadDir(codeLocalPath) |
|
|
|
if err == nil { |
|
|
|
os.RemoveAll(codeLocalPath) |
|
|
|
} else { |
|
|
|
log.Error("创建任务失败,原代码还未删除,请重试!: %s (%v)", repo.FullName(), err) |
|
|
|
versionErrorDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("创建任务失败,原代码还未删除,请重试!", tplModelArtsTrainJobVersionNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
// os.RemoveAll(codeLocalPath) |
|
|
|
|
|
|
|
gitRepo, _ := git.OpenRepository(repo.RepoPath()) |
|
|
|
commitID, _ := gitRepo.GetBranchCommitID(branch_name) |
|
|
|
if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{ |
|
|
|
Branch: branch_name, |
|
|
|
}); err != nil { |
|
|
|
log.Error("创建任务失败,任务名称已存在!: %s (%v)", repo.FullName(), err) |
|
|
|
log.Error("Failed git clone repo to local(!: %s (%v)", repo.FullName(), err) |
|
|
|
versionErrorDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("创建任务失败,任务名称已存在!", tplModelArtsTrainJobVersionNew, &form) |
|
|
|
ctx.RenderWithErr("Failed git clone repo to local!", tplModelArtsTrainJobVersionNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
|