|
|
|
@@ -485,6 +485,9 @@ func TrainJobIndex(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
listType := ctx.Query("listType") |
|
|
|
if len(listType) == 0 { |
|
|
|
listType = models.AllResource |
|
|
|
} |
|
|
|
ctx.Data["ListType"] = listType |
|
|
|
|
|
|
|
typeCloudBrain := models.TypeCloudBrainAll |
|
|
|
@@ -531,6 +534,7 @@ func TrainJobIndex(ctx *context.Context) { |
|
|
|
|
|
|
|
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) |
|
|
|
pager.SetDefaultParams(ctx) |
|
|
|
pager.AddParam(ctx, "listType", "ListType") |
|
|
|
ctx.Data["Page"] = pager |
|
|
|
|
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
@@ -1567,6 +1571,7 @@ func trainJobGetLog(jobID string) (*models.GetTrainJobLogFileNamesResult, *model |
|
|
|
|
|
|
|
func TrainJobDel(ctx *context.Context) { |
|
|
|
var jobID = ctx.Params(":jobid") |
|
|
|
var listType = ctx.Query("listType") |
|
|
|
repo := ctx.Repo.Repository |
|
|
|
|
|
|
|
var jobTypes []string |
|
|
|
@@ -1608,12 +1613,13 @@ func TrainJobDel(ctx *context.Context) { |
|
|
|
if ctx.IsUserSiteAdmin() && isAdminPage == "true" { |
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") |
|
|
|
} else { |
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job") |
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job?listType=" + listType) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TrainJobStop(ctx *context.Context) { |
|
|
|
var jobID = ctx.Params(":jobid") |
|
|
|
var listType = ctx.Query("listType") |
|
|
|
task := ctx.Cloudbrain |
|
|
|
|
|
|
|
_, err := modelarts.StopTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) |
|
|
|
@@ -1623,7 +1629,7 @@ func TrainJobStop(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job") |
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job?listType=" + listType) |
|
|
|
} |
|
|
|
|
|
|
|
func canUserCreateTrainJob(uid int64) (bool, error) { |
|
|
|
|