Browse Source

Merge branch 'liuzx_trainjob' of https://git.openi.org.cn/OpenI/aiforge into liuzx_trainjob

pull/669/head
zhoupzh 3 years ago
parent
commit
2e308125c6
3 changed files with 20 additions and 18 deletions
  1. +18
    -18
      routers/repo/modelarts.go
  2. +1
    -0
      templates/repo/modelarts/notebook/index.tmpl
  3. +1
    -0
      templates/repo/modelarts/trainjob/index.tmpl

+ 18
- 18
routers/repo/modelarts.go View File

@@ -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
}



+ 1
- 0
templates/repo/modelarts/notebook/index.tmpl View File

@@ -200,6 +200,7 @@
{{template "repo/header" .}}
<!-- 列表容器 -->
<div class="ui container">
{{template "base/alert" .}}

<!-- 中间云脑和新建任务按钮 -->


+ 1
- 0
templates/repo/modelarts/trainjob/index.tmpl View File

@@ -200,6 +200,7 @@
{{template "repo/header" .}}
<!-- 列表容器 -->
<div class="ui container">
{{template "base/alert" .}}

<!-- 中间云脑和新建任务按钮 -->
<!-- <div class="ui three column stack able grid">


Loading…
Cancel
Save