|
|
@@ -17,9 +17,9 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
const ( |
|
|
|
tplModelArtsIndex base.TplName = "repo/modelarts/index" |
|
|
|
tplModelArtsNew base.TplName = "repo/modelarts/new" |
|
|
|
tplModelArtsShow base.TplName = "repo/modelarts/show" |
|
|
|
tplModelArtsNotebookIndex base.TplName = "repo/modelarts/notebook/index" |
|
|
|
tplModelArtsNotebookNew base.TplName = "repo/modelarts/notebook/new" |
|
|
|
tplModelArtsNotebookShow base.TplName = "repo/modelarts/notebook/show" |
|
|
|
) |
|
|
|
|
|
|
|
// MustEnableDataset check if repository enable internal cb |
|
|
@@ -44,7 +44,7 @@ func NotebookIndex(ctx *context.Context) { |
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
}, |
|
|
|
RepoID: repo.ID, |
|
|
|
Type: models.TypeCloudBrainTwo, |
|
|
|
Type: models.TypeCloudBrainNotebook, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Cloudbrain", err) |
|
|
@@ -65,7 +65,7 @@ func NotebookIndex(ctx *context.Context) { |
|
|
|
|
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
ctx.Data["Tasks"] = ciTasks |
|
|
|
ctx.HTML(200, tplModelArtsIndex) |
|
|
|
ctx.HTML(200, tplModelArtsNotebookIndex) |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookNew(ctx *context.Context) { |
|
|
@@ -86,7 +86,7 @@ func NotebookNew(ctx *context.Context) { |
|
|
|
ctx.Data["env"] = modelarts.NotebookEnv |
|
|
|
ctx.Data["notebook_type"] = modelarts.NotebookType |
|
|
|
ctx.Data["flavor"] = modelarts.FlavorInfo |
|
|
|
ctx.HTML(200, tplModelArtsNew) |
|
|
|
ctx.HTML(200, tplModelArtsNotebookNew) |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookCreate(ctx *context.Context, form auth.CreateModelArtsForm) { |
|
|
@@ -98,11 +98,11 @@ func NotebookCreate(ctx *context.Context, form auth.CreateModelArtsForm) { |
|
|
|
|
|
|
|
err := modelarts.GenerateTask(ctx, jobName, uuid, description) |
|
|
|
if err != nil { |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNew, &form) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts") |
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookShow(ctx *context.Context) { |
|
|
@@ -112,14 +112,14 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
result, err := modelarts.GetJob(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@@ -128,7 +128,7 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
err = models.UpdateJob(task) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@@ -143,7 +143,7 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["jobID"] = jobID |
|
|
|
ctx.Data["result"] = result |
|
|
|
ctx.HTML(200, tplModelArtsShow) |
|
|
|
ctx.HTML(200, tplModelArtsNotebookShow) |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookDebug(ctx *context.Context) { |
|
|
@@ -156,13 +156,13 @@ func NotebookDebug(ctx *context.Context) { |
|
|
|
|
|
|
|
result, err := modelarts.GetJob(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
res, err := modelarts.GetJobToken(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsIndex, nil) |
|
|
|
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|