|
@@ -26,6 +26,8 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
const ( |
|
|
const ( |
|
|
|
|
|
tplDebugJobIndex base.TplName = "repo/debugjob/index" |
|
|
|
|
|
|
|
|
tplModelArtsNotebookIndex base.TplName = "repo/modelarts/notebook/index" |
|
|
tplModelArtsNotebookIndex base.TplName = "repo/modelarts/notebook/index" |
|
|
tplModelArtsNotebookNew base.TplName = "repo/modelarts/notebook/new" |
|
|
tplModelArtsNotebookNew base.TplName = "repo/modelarts/notebook/new" |
|
|
tplModelArtsNotebookShow base.TplName = "repo/modelarts/notebook/show" |
|
|
tplModelArtsNotebookShow base.TplName = "repo/modelarts/notebook/show" |
|
@@ -36,6 +38,60 @@ const ( |
|
|
tplModelArtsTrainJobVersionNew base.TplName = "repo/modelarts/trainjob/version_new" |
|
|
tplModelArtsTrainJobVersionNew base.TplName = "repo/modelarts/trainjob/version_new" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func DebugJobIndex(ctx *context.Context) { |
|
|
|
|
|
MustEnableCloudbrain(ctx) |
|
|
|
|
|
repo := ctx.Repo.Repository |
|
|
|
|
|
page := ctx.QueryInt("page") |
|
|
|
|
|
if page <= 0 { |
|
|
|
|
|
page = 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
|
|
ListOptions: models.ListOptions{ |
|
|
|
|
|
Page: page, |
|
|
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
|
|
}, |
|
|
|
|
|
RepoID: repo.ID, |
|
|
|
|
|
Type: modelarts.DebugType, |
|
|
|
|
|
JobType: string(models.JobTypeDebug), |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
ctx.ServerError("Get debugjob faild:", err) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
timestamp := time.Now().Unix() |
|
|
|
|
|
|
|
|
|
|
|
for i, task := range ciTasks { |
|
|
|
|
|
if task.Cloudbrain.Type == models.TypeCloudBrainOne { |
|
|
|
|
|
if task.Status == string(models.JobRunning) && (timestamp-int64(task.Cloudbrain.CreatedUnix) > 10) { |
|
|
|
|
|
ciTasks[i].CanDebug = true |
|
|
|
|
|
} else { |
|
|
|
|
|
ciTasks[i].CanDebug = false |
|
|
|
|
|
} |
|
|
|
|
|
ciTasks[i].CanDel = models.CanDelJob(ctx.IsSigned, ctx.User, task) |
|
|
|
|
|
ciTasks[i].Cloudbrain.ComputeResource = modelarts.GPUResource |
|
|
|
|
|
} |
|
|
|
|
|
if task.Cloudbrain.Type == models.TypeCloudBrainTwo { |
|
|
|
|
|
if task.Status == string(models.JobRunning) { |
|
|
|
|
|
ciTasks[i].CanDebug = true |
|
|
|
|
|
} else { |
|
|
|
|
|
ciTasks[i].CanDebug = false |
|
|
|
|
|
} |
|
|
|
|
|
ciTasks[i].Cloudbrain.ComputeResource = modelarts.NPUResource |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) |
|
|
|
|
|
pager.SetDefaultParams(ctx) |
|
|
|
|
|
ctx.Data["Page"] = pager |
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
ctx.Data["Tasks"] = ciTasks |
|
|
|
|
|
ctx.HTML(200, tplDebugJobIndex) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// MustEnableDataset check if repository enable internal cb |
|
|
// MustEnableDataset check if repository enable internal cb |
|
|
func MustEnableModelArts(ctx *context.Context) { |
|
|
func MustEnableModelArts(ctx *context.Context) { |
|
|
if !ctx.Repo.CanRead(models.UnitTypeCloudBrain) { |
|
|
if !ctx.Repo.CanRead(models.UnitTypeCloudBrain) { |
|
|