|
|
@@ -594,12 +594,19 @@ func trainJobNewDataPrepare(ctx *context.Context) error { |
|
|
|
outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath |
|
|
|
ctx.Data["train_url"] = outputObsPath |
|
|
|
|
|
|
|
Branches, err := ctx.Repo.GitRepo.GetBranches() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("GetBranches error:", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
ctx.Data["Branches"] = Branches |
|
|
|
ctx.Data["BranchesCount"] = len(Branches) |
|
|
|
|
|
|
|
configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("getConfigList failed:", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Data["config_list"] = configList.ParaConfigs |
|
|
|
|
|
|
|
return nil |
|
|
@@ -623,6 +630,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath |
|
|
|
logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath |
|
|
|
dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/" |
|
|
|
branch_name := form.BranchName |
|
|
|
|
|
|
|
//can, err := canUserCreateTrainJob(ctx.User.ID) |
|
|
|
//if err != nil { |
|
|
@@ -655,7 +663,13 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
if err == nil { |
|
|
|
os.RemoveAll(codeLocalPath) |
|
|
|
} |
|
|
|
if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { |
|
|
|
// branch_name := "testbranch" |
|
|
|
// 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) |
|
|
|
trainJobNewDataPrepare(ctx) |
|
|
|
|
|
|
@@ -663,6 +677,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
ctx.Data["uuid"] = form.Attachment |
|
|
|
ctx.Data["datasetName"] = attach.Name |
|
|
|
ctx.Data["params"] = form.Params |
|
|
|
ctx.Data["branch_name"] = branch_name |
|
|
|
trainJobNewDataPrepare(ctx) |
|
|
|
// ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) |
|
|
|
ctx.RenderWithErr("创建任务失败,任务名称已存在!", tplModelArtsTrainJobNew, &form) |
|
|
|