|
|
@@ -329,8 +329,6 @@ func TrainJobNew(ctx *context.Context) { |
|
|
ctx.HTML(200, tplModelArtsTrainJobNew) |
|
|
ctx.HTML(200, tplModelArtsTrainJobNew) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//todo: show the error in html |
|
|
|
|
|
//todo; param check |
|
|
|
|
|
func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) { |
|
|
func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) { |
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
jobName := form.JobName |
|
|
jobName := form.JobName |
|
|
@@ -341,6 +339,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
bootFile := form.BootFile |
|
|
bootFile := form.BootFile |
|
|
flavorCode := form.Flavor |
|
|
flavorCode := form.Flavor |
|
|
poolID := form.PoolID |
|
|
poolID := form.PoolID |
|
|
|
|
|
isSaveParam := form.IsSaveParam |
|
|
repo := ctx.Repo.Repository |
|
|
repo := ctx.Repo.Repository |
|
|
codeLocalPath := setting.JobPath + jobName + modelarts.CodePath |
|
|
codeLocalPath := setting.JobPath + jobName + modelarts.CodePath |
|
|
codeObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.CodePath |
|
|
codeObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.CodePath |
|
|
@@ -355,6 +354,10 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if isSaveParam == "on" { |
|
|
|
|
|
//todo: save param |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { |
|
|
if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { |
|
|
log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err) |
|
|
log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err) |
|
|
ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) |
|
|
ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) |
|
|
@@ -480,12 +483,12 @@ func obsMkdir(dir string) error { |
|
|
func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error { |
|
|
func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error { |
|
|
if !strings.HasSuffix(form.BootFile, ".py") { |
|
|
if !strings.HasSuffix(form.BootFile, ".py") { |
|
|
log.Error("the boot file(%s) must be a python file", form.BootFile) |
|
|
log.Error("the boot file(%s) must be a python file", form.BootFile) |
|
|
return errors.New("the boot file is not a python file") |
|
|
|
|
|
|
|
|
return errors.New("启动文件必须是python文件") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if form.WorkServerNumber > 25 || form.WorkServerNumber < 1{ |
|
|
if form.WorkServerNumber > 25 || form.WorkServerNumber < 1{ |
|
|
log.Error("the WorkServerNumber(%d) must be in (1,25)", form.WorkServerNumber) |
|
|
log.Error("the WorkServerNumber(%d) must be in (1,25)", form.WorkServerNumber) |
|
|
return errors.New("the WorkServerNumber(%d) must be in (1,25)") |
|
|
|
|
|
|
|
|
return errors.New("计算节点数必须在1-25之间") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return nil |
|
|
return nil |
|
|
|