|
|
|
@@ -46,20 +46,26 @@ const ( |
|
|
|
) |
|
|
|
|
|
|
|
func DebugJobIndex(ctx *context.Context) { |
|
|
|
debugListType := ctx.Query("debugListType") |
|
|
|
ctx.Data["ListType"] = debugListType |
|
|
|
listType := ctx.Query("debugListType") |
|
|
|
ctx.Data["ListType"] = listType |
|
|
|
MustEnableCloudbrain(ctx) |
|
|
|
repo := ctx.Repo.Repository |
|
|
|
page := ctx.QueryInt("page") |
|
|
|
if page <= 0 { |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
debugType := modelarts.DebugType |
|
|
|
typeCloudBrain := models.TypeCloudBrainAll |
|
|
|
jobTypeNot := false |
|
|
|
if debugListType == models.GPUResource { |
|
|
|
debugType = models.TypeCloudBrainOne |
|
|
|
} else if debugListType == models.NPUResource { |
|
|
|
debugType = models.TypeCloudBrainTwo |
|
|
|
if listType == models.GPUResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainOne |
|
|
|
} else if listType == models.NPUResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainTwo |
|
|
|
} else if listType == models.AllResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainAll |
|
|
|
} else { |
|
|
|
log.Error("listType(%s) error", listType) |
|
|
|
ctx.ServerError("listType error", errors.New("listType error")) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var jobTypes []string |
|
|
|
@@ -70,7 +76,7 @@ func DebugJobIndex(ctx *context.Context) { |
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
}, |
|
|
|
RepoID: repo.ID, |
|
|
|
Type: debugType, |
|
|
|
Type: typeCloudBrain, |
|
|
|
JobTypeNot: jobTypeNot, |
|
|
|
JobTypes: jobTypes, |
|
|
|
}) |
|
|
|
@@ -92,7 +98,7 @@ func DebugJobIndex(ctx *context.Context) { |
|
|
|
ctx.Data["Tasks"] = ciTasks |
|
|
|
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) |
|
|
|
ctx.Data["RepoIsEmpty"] = repo.IsEmpty |
|
|
|
ctx.Data["debugListType"] = debugListType |
|
|
|
ctx.Data["debugListType"] = listType |
|
|
|
ctx.HTML(200, tplDebugJobIndex) |
|
|
|
} |
|
|
|
|
|
|
|
@@ -473,6 +479,23 @@ func TrainJobIndex(ctx *context.Context) { |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
|
|
|
|
listType := ctx.Query("listType") |
|
|
|
ctx.Data["ListType"] = listType |
|
|
|
|
|
|
|
typeCloudBrain := models.TypeCloudBrainAll |
|
|
|
if listType == models.GPUResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainOne |
|
|
|
} else if listType == models.NPUResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainTwo |
|
|
|
} else if listType == models.AllResource { |
|
|
|
typeCloudBrain = models.TypeCloudBrainAll |
|
|
|
} |
|
|
|
//else { |
|
|
|
// log.Error("listType(%s) error", listType) |
|
|
|
// ctx.ServerError("listType error", errors.New("listType error")) |
|
|
|
// return |
|
|
|
//} |
|
|
|
|
|
|
|
var jobTypes []string |
|
|
|
jobTypes = append(jobTypes, string(models.JobTypeTrain)) |
|
|
|
tasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
@@ -481,7 +504,7 @@ func TrainJobIndex(ctx *context.Context) { |
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
}, |
|
|
|
RepoID: repo.ID, |
|
|
|
Type: models.TypeCloudBrainTwo, |
|
|
|
Type: typeCloudBrain, |
|
|
|
JobTypeNot: false, |
|
|
|
JobTypes: jobTypes, |
|
|
|
IsLatestVersion: modelarts.IsLatestVersion, |
|
|
|
@@ -2246,7 +2269,7 @@ func SetJobCount(ctx *context.Context) { |
|
|
|
repoId := ctx.Repo.Repository.ID |
|
|
|
_, jobCount, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
RepoID: repoId, |
|
|
|
Type: modelarts.DebugType, |
|
|
|
Type: models.TypeCloudBrainAll, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Get job faild:", err) |
|
|
|
|