|
|
@@ -357,14 +357,14 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
result, err := modelarts.GetJob(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@@ -373,7 +373,7 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
err = models.UpdateJob(task) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@@ -614,17 +614,17 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath |
|
|
|
dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" |
|
|
|
|
|
|
|
can, err := canUserCreateTrainJob(ctx.User.ID) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("canUserCreateTrainJob", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if !can { |
|
|
|
log.Error("the user can not create train-job") |
|
|
|
ctx.RenderWithErr("the user can not create train-job", tplModelArtsTrainJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
//can, err := canUserCreateTrainJob(ctx.User.ID) |
|
|
|
//if err != nil { |
|
|
|
// ctx.ServerError("canUserCreateTrainJob", err) |
|
|
|
// return |
|
|
|
//} |
|
|
|
// |
|
|
|
//if !can { |
|
|
|
// log.Error("the user can not create train-job") |
|
|
|
// ctx.RenderWithErr("the user can not create train-job", tplModelArtsTrainJobNew, &form) |
|
|
|
// return |
|
|
|
//} |
|
|
|
|
|
|
|
//param check |
|
|
|
if err := paramCheckCreateTrainJob(form); err != nil { |
|
|
@@ -735,7 +735,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
|
Parameters: param, |
|
|
|
} |
|
|
|
|
|
|
|
err = modelarts.GenerateTrainJob(ctx, req) |
|
|
|
err := modelarts.GenerateTrainJob(ctx, req) |
|
|
|
if err != nil { |
|
|
|
log.Error("GenerateTrainJob failed:%v", err.Error()) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) |
|
|
@@ -838,21 +838,21 @@ func TrainJobShow(ctx *context.Context) { |
|
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetCloudbrainByJobID(%s) failed:%v", jobID, err.Error()) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
attach, err := models.GetAttachmentByUUID(task.Uuid) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetAttachmentByUUID(%s) failed:%v", jobID, err.Error()) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
result, err := modelarts.GetTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetJob(%s) failed:%v", jobID, err.Error()) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|