| @@ -208,7 +208,7 @@ type CloudbrainsOptions struct { | |||||
| CloudbrainIDs []int64 | CloudbrainIDs []int64 | ||||
| // JobStatus CloudbrainStatus | // JobStatus CloudbrainStatus | ||||
| Type int | Type int | ||||
| JobType string | |||||
| JobTypes []string | |||||
| VersionName string | VersionName string | ||||
| IsLatestVersion string | IsLatestVersion string | ||||
| JobTypeNot bool | JobTypeNot bool | ||||
| @@ -911,14 +911,14 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||||
| ) | ) | ||||
| } | } | ||||
| if (opts.JobType) != "" { | |||||
| if len(opts.JobTypes) > 0 { | |||||
| if opts.JobTypeNot { | if opts.JobTypeNot { | ||||
| cond = cond.And( | cond = cond.And( | ||||
| builder.Neq{"cloudbrain.job_type": opts.JobType}, | |||||
| builder.NotIn("cloudbrain.job_type", opts.JobTypes), | |||||
| ) | ) | ||||
| } else { | } else { | ||||
| cond = cond.And( | cond = cond.And( | ||||
| builder.Eq{"cloudbrain.job_type": opts.JobType}, | |||||
| builder.In("cloudbrain.job_type", opts.JobTypes), | |||||
| ) | ) | ||||
| } | } | ||||
| } | } | ||||
| @@ -1042,9 +1042,9 @@ func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int, e | |||||
| ) | ) | ||||
| } | } | ||||
| if (opts.JobType) != "" { | |||||
| if len(opts.JobTypes) > 0 { | |||||
| cond = cond.And( | cond = cond.And( | ||||
| builder.Eq{"cloudbrain.job_type": opts.JobType}, | |||||
| builder.In("cloudbrain.job_type", opts.JobTypes), | |||||
| ) | ) | ||||
| } | } | ||||
| @@ -329,11 +329,13 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job | |||||
| return err | return err | ||||
| } | } | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeTrain)) | |||||
| repo := ctx.Repo.Repository | repo := ctx.Repo.Repository | ||||
| VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypes: jobTypes, | |||||
| JobID: strconv.FormatInt(jobResult.JobID, 10), | JobID: strconv.FormatInt(jobResult.JobID, 10), | ||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -223,10 +223,12 @@ func DelTrainJobVersion(ctx *context.APIContext) { | |||||
| //获取删除后的版本数量 | //获取删除后的版本数量 | ||||
| repo := ctx.Repo.Repository | repo := ctx.Repo.Repository | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeTrain)) | |||||
| VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypes: jobTypes, | |||||
| JobID: jobID, | JobID: jobID, | ||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -32,6 +32,7 @@ const ( | |||||
| tplCloudBrainShow base.TplName = "repo/cloudbrain/show" | tplCloudBrainShow base.TplName = "repo/cloudbrain/show" | ||||
| tplCloudBrainShowModels base.TplName = "repo/cloudbrain/models/index" | tplCloudBrainShowModels base.TplName = "repo/cloudbrain/models/index" | ||||
| tplCloudBrainBenchmarkIndex base.TplName = "repo/cloudbrain/benchmark/index" | |||||
| tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new" | tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new" | ||||
| ) | ) | ||||
| @@ -942,6 +943,8 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { | |||||
| page = 1 | page = 1 | ||||
| } | } | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeBenchmark)) | |||||
| ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | ||||
| ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
| Page: page, | Page: page, | ||||
| @@ -949,7 +952,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { | |||||
| }, | }, | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainOne, | Type: models.TypeCloudBrainOne, | ||||
| JobType: string(models.JobTypeBenchmark), | |||||
| JobTypes: jobTypes, | |||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("Get debugjob faild:", err) | ctx.ServerError("Get debugjob faild:", err) | ||||
| @@ -968,7 +971,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { | |||||
| ctx.Data["Tasks"] = ciTasks | ctx.Data["Tasks"] = ciTasks | ||||
| ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ||||
| ctx.Data["RepoIsEmpty"] = repo.IsEmpty | ctx.Data["RepoIsEmpty"] = repo.IsEmpty | ||||
| ctx.HTML(200, tplBenchMarkIndex) | |||||
| ctx.HTML(200, tplCloudBrainBenchmarkIndex) | |||||
| } | } | ||||
| func CloudBrainBenchmarkNew(ctx *context.Context) { | func CloudBrainBenchmarkNew(ctx *context.Context) { | ||||
| @@ -37,8 +37,6 @@ const ( | |||||
| tplModelArtsTrainJobNew base.TplName = "repo/modelarts/trainjob/new" | tplModelArtsTrainJobNew base.TplName = "repo/modelarts/trainjob/new" | ||||
| tplModelArtsTrainJobShow base.TplName = "repo/modelarts/trainjob/show" | tplModelArtsTrainJobShow base.TplName = "repo/modelarts/trainjob/show" | ||||
| tplModelArtsTrainJobVersionNew base.TplName = "repo/modelarts/trainjob/version_new" | tplModelArtsTrainJobVersionNew base.TplName = "repo/modelarts/trainjob/version_new" | ||||
| tplBenchMarkIndex base.TplName = "repo/cloudbrain/benchmark/index" | |||||
| ) | ) | ||||
| func DebugJobIndex(ctx *context.Context) { | func DebugJobIndex(ctx *context.Context) { | ||||
| @@ -57,6 +55,8 @@ func DebugJobIndex(ctx *context.Context) { | |||||
| debugType = models.TypeCloudBrainTwo | debugType = models.TypeCloudBrainTwo | ||||
| } | } | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeDebug), string(models.JobTypeBrainScore)) | |||||
| ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | ||||
| ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
| Page: page, | Page: page, | ||||
| @@ -64,8 +64,8 @@ func DebugJobIndex(ctx *context.Context) { | |||||
| }, | }, | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: debugType, | Type: debugType, | ||||
| JobTypeNot: true, | |||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypeNot: false, | |||||
| JobTypes: jobTypes, | |||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("Get debugjob faild:", err) | ctx.ServerError("Get debugjob faild:", err) | ||||
| @@ -369,6 +369,8 @@ func TrainJobIndex(ctx *context.Context) { | |||||
| page = 1 | page = 1 | ||||
| } | } | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeTrain)) | |||||
| tasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | tasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | ||||
| ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
| Page: page, | Page: page, | ||||
| @@ -377,7 +379,7 @@ func TrainJobIndex(ctx *context.Context) { | |||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| JobTypeNot: false, | JobTypeNot: false, | ||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypes: jobTypes, | |||||
| IsLatestVersion: modelarts.IsLatestVersion, | IsLatestVersion: modelarts.IsLatestVersion, | ||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -1275,6 +1277,9 @@ func TrainJobShow(ctx *context.Context) { | |||||
| if page <= 0 { | if page <= 0 { | ||||
| page = 1 | page = 1 | ||||
| } | } | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeTrain)) | |||||
| VersionListTasks, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | VersionListTasks, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | ||||
| ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
| Page: page, | Page: page, | ||||
| @@ -1282,7 +1287,7 @@ func TrainJobShow(ctx *context.Context) { | |||||
| }, | }, | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypes: jobTypes, | |||||
| JobID: jobID, | JobID: jobID, | ||||
| }) | }) | ||||
| @@ -1394,10 +1399,12 @@ func TrainJobDel(ctx *context.Context) { | |||||
| var jobID = ctx.Params(":jobid") | var jobID = ctx.Params(":jobid") | ||||
| repo := ctx.Repo.Repository | repo := ctx.Repo.Repository | ||||
| var jobTypes []string | |||||
| jobTypes = append(jobTypes, string(models.JobTypeTrain)) | |||||
| VersionListTasks, _, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | VersionListTasks, _, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{ | ||||
| RepoID: repo.ID, | RepoID: repo.ID, | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| JobType: string(models.JobTypeTrain), | |||||
| JobTypes: jobTypes, | |||||
| JobID: jobID, | JobID: jobID, | ||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||