|
|
|
@@ -329,14 +329,15 @@ func NotebookManage(ctx *context.Context) { |
|
|
|
var resultCode = "0" |
|
|
|
var errorMsg = "" |
|
|
|
var status = "" |
|
|
|
task, err := models.GetCloudbrainByID(ID) |
|
|
|
if err != nil { |
|
|
|
log.Error("get task(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"]) |
|
|
|
resultCode = "-1" |
|
|
|
errorMsg = "system error" |
|
|
|
} |
|
|
|
|
|
|
|
for { |
|
|
|
task, err := models.GetCloudbrainByID(ID) |
|
|
|
if err != nil { |
|
|
|
log.Error("get task(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"]) |
|
|
|
resultCode = "-1" |
|
|
|
errorMsg = "system error" |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
if action == models.ActionStop { |
|
|
|
if task.Status != string(models.ModelArtsRunning) { |
|
|
|
@@ -572,8 +573,6 @@ func trainJobNewDataPrepare(ctx *context.Context) error { |
|
|
|
} |
|
|
|
ctx.Data["flavor_infos"] = flavorInfos.Info |
|
|
|
|
|
|
|
// outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath |
|
|
|
// ctx.Data["train_url"] = outputObsPath |
|
|
|
ctx.Data["params"] = "" |
|
|
|
ctx.Data["branchName"] = ctx.Repo.BranchName |
|
|
|
|
|
|
|
@@ -641,9 +640,6 @@ func trainJobErrorNewDataPrepare(ctx *context.Context, form auth.CreateModelArts |
|
|
|
} |
|
|
|
ctx.Data["flavor_infos"] = flavorInfos.Info |
|
|
|
|
|
|
|
// outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath |
|
|
|
// ctx.Data["train_url"] = outputObsPath |
|
|
|
|
|
|
|
configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("getConfigList failed:", err) |
|
|
|
@@ -735,9 +731,6 @@ func trainJobNewVersionDataPrepare(ctx *context.Context) error { |
|
|
|
} |
|
|
|
ctx.Data["params"] = Parameters.Parameter |
|
|
|
|
|
|
|
// outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath |
|
|
|
// ctx.Data["train_url"] = outputObsPath |
|
|
|
|
|
|
|
branches, _, err := ctx.Repo.GitRepo.GetBranches(0, 0) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("GetBranches error:", err) |
|
|
|
@@ -905,13 +898,11 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
//Determine whether the task name of the task in the project is duplicated |
|
|
|
tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, string(models.JobTypeTrain), displayJobName) |
|
|
|
if err == nil { |
|
|
|
for _, task := range tasks { |
|
|
|
if strings.EqualFold(task.DisplayJobName, displayJobName) { |
|
|
|
log.Error("the job name did already exist", ctx.Data["MsgID"]) |
|
|
|
trainJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("the job name did already exist", tplModelArtsTrainJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
if len(tasks) != 0 { |
|
|
|
log.Error("the job name did already exist", ctx.Data["MsgID"]) |
|
|
|
trainJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("the job name did already exist", tplModelArtsTrainJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
if !models.IsErrJobNotExist(err) { |
|
|
|
@@ -1738,13 +1729,11 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference |
|
|
|
//Determine whether the task name of the task in the project is duplicated |
|
|
|
tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, string(models.JobTypeInference), displayJobName) |
|
|
|
if err == nil { |
|
|
|
for _, task := range tasks { |
|
|
|
if strings.EqualFold(task.DisplayJobName, displayJobName) { |
|
|
|
log.Error("the job name did already exist", ctx.Data["MsgID"]) |
|
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("the job name did already exist", tplModelArtsInferenceJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
if len(tasks) != 0 { |
|
|
|
log.Error("the job name did already exist", ctx.Data["MsgID"]) |
|
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("the job name did already exist", tplModelArtsInferenceJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
if !models.IsErrJobNotExist(err) { |
|
|
|
|