Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1174 Reviewed-by: ychao_1983 <ychao_1983@sina.com>tags/v1.21.12.2^2
| @@ -19,6 +19,9 @@ type JobType string | |||||
| type ModelArtsJobStatus string | type ModelArtsJobStatus string | ||||
| const ( | const ( | ||||
| NPUResource = "NPU" | |||||
| GPUResource = "CPU/GPU" | |||||
| JobWaiting CloudbrainStatus = "WAITING" | JobWaiting CloudbrainStatus = "WAITING" | ||||
| JobStopped CloudbrainStatus = "STOPPED" | JobStopped CloudbrainStatus = "STOPPED" | ||||
| JobSucceeded CloudbrainStatus = "SUCCEEDED" | JobSucceeded CloudbrainStatus = "SUCCEEDED" | ||||
| @@ -105,7 +108,7 @@ type Cloudbrain struct { | |||||
| IsLatestVersion string //是否是最新版本,1是,0否 | IsLatestVersion string //是否是最新版本,1是,0否 | ||||
| CommitID string //提交的仓库代码id | CommitID string //提交的仓库代码id | ||||
| PreVersionName string //父版本名称 | PreVersionName string //父版本名称 | ||||
| ComputeResource string `xorm:"-"` //计算资源,例如npu | |||||
| ComputeResource string //计算资源,例如npu | |||||
| EngineID int64 //引擎id | EngineID int64 //引擎id | ||||
| TrainUrl string //输出的obs路径 | TrainUrl string //输出的obs路径 | ||||
| @@ -212,6 +212,7 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||||
| Image: image, | Image: image, | ||||
| GpuQueue: gpuQueue, | GpuQueue: gpuQueue, | ||||
| ResourceSpecId: resourceSpecId, | ResourceSpecId: resourceSpecId, | ||||
| ComputeResource: models.GPUResource, | |||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -48,10 +48,6 @@ const ( | |||||
| PerPage = 10 | PerPage = 10 | ||||
| IsLatestVersion = "1" | IsLatestVersion = "1" | ||||
| NotLatestVersion = "0" | NotLatestVersion = "0" | ||||
| // ComputeResource = "NPU" | |||||
| NPUResource = "NPU" | |||||
| GPUResource = "CPU/GPU" | |||||
| AllResource = "all" | |||||
| DebugType = -1 | DebugType = -1 | ||||
| VersionCount = 1 | VersionCount = 1 | ||||
| @@ -277,7 +273,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
| DatasetName: attach.Name, | DatasetName: attach.Name, | ||||
| CommitID: req.CommitID, | CommitID: req.CommitID, | ||||
| IsLatestVersion: req.IsLatestVersion, | IsLatestVersion: req.IsLatestVersion, | ||||
| //ComputeResource: NPUResource, | |||||
| ComputeResource: models.NPUResource, | |||||
| EngineID: req.EngineID, | EngineID: req.EngineID, | ||||
| TrainUrl: req.TrainUrl, | TrainUrl: req.TrainUrl, | ||||
| BranchName: req.BranchName, | BranchName: req.BranchName, | ||||
| @@ -360,7 +356,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job | |||||
| CommitID: req.CommitID, | CommitID: req.CommitID, | ||||
| IsLatestVersion: req.IsLatestVersion, | IsLatestVersion: req.IsLatestVersion, | ||||
| PreVersionName: req.PreVersionName, | PreVersionName: req.PreVersionName, | ||||
| ComputeResource: NPUResource, | |||||
| ComputeResource: models.GPUResource, | |||||
| EngineID: req.EngineID, | EngineID: req.EngineID, | ||||
| TrainUrl: req.TrainUrl, | TrainUrl: req.TrainUrl, | ||||
| BranchName: req.BranchName, | BranchName: req.BranchName, | ||||
| @@ -245,7 +245,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") | |||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") | |||||
| } | } | ||||
| func CloudBrainRestart(ctx *context.Context) { | func CloudBrainRestart(ctx *context.Context) { | ||||
| @@ -568,7 +568,7 @@ func CloudBrainDel(ctx *context.Context) { | |||||
| } | } | ||||
| deleteJobStorage(task.JobName, models.TypeCloudBrainOne) | deleteJobStorage(task.JobName, models.TypeCloudBrainOne) | ||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") | |||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") | |||||
| } | } | ||||
| func CloudBrainShowModels(ctx *context.Context) { | func CloudBrainShowModels(ctx *context.Context) { | ||||
| @@ -51,11 +51,11 @@ func DebugJobIndex(ctx *context.Context) { | |||||
| } | } | ||||
| debugType := modelarts.DebugType | debugType := modelarts.DebugType | ||||
| jobType := string(models.JobTypeDebug) | jobType := string(models.JobTypeDebug) | ||||
| if debugListType == modelarts.GPUResource { | |||||
| if debugListType == models.GPUResource { | |||||
| debugType = models.TypeCloudBrainOne | debugType = models.TypeCloudBrainOne | ||||
| jobType = "" | jobType = "" | ||||
| } | } | ||||
| if debugListType == modelarts.NPUResource { | |||||
| if debugListType == models.NPUResource { | |||||
| debugType = models.TypeCloudBrainTwo | debugType = models.TypeCloudBrainTwo | ||||
| } | } | ||||
| @@ -76,16 +76,10 @@ func DebugJobIndex(ctx *context.Context) { | |||||
| for i, task := range ciTasks { | for i, task := range ciTasks { | ||||
| ciTasks[i].CanDebug = cloudbrain.CanCreateOrDebugJob(ctx) | ciTasks[i].CanDebug = cloudbrain.CanCreateOrDebugJob(ctx) | ||||
| ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | ||||
| if task.Cloudbrain.Type == models.TypeCloudBrainOne { | |||||
| ciTasks[i].Cloudbrain.ComputeResource = modelarts.GPUResource | |||||
| } else if task.Cloudbrain.Type == models.TypeCloudBrainTwo { | |||||
| ciTasks[i].Cloudbrain.ComputeResource = modelarts.NPUResource | |||||
| } | |||||
| ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | |||||
| } | } | ||||
| pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) | pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) | ||||
| //pager.SetDefaultParams(ctx) | |||||
| pager.AddParam(ctx, "debugListType", "ListType") | pager.AddParam(ctx, "debugListType", "ListType") | ||||
| ctx.Data["Page"] = pager | ctx.Data["Page"] = pager | ||||
| ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
| @@ -345,7 +339,7 @@ func NotebookDel(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") | |||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") | |||||
| } | } | ||||
| func TrainJobIndex(ctx *context.Context) { | func TrainJobIndex(ctx *context.Context) { | ||||
| @@ -375,7 +369,7 @@ func TrainJobIndex(ctx *context.Context) { | |||||
| for i, task := range tasks { | for i, task := range tasks { | ||||
| tasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | tasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | ||||
| tasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | tasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | ||||
| tasks[i].ComputeResource = modelarts.NPUResource | |||||
| tasks[i].ComputeResource = models.NPUResource | |||||
| } | } | ||||
| pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) | pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) | ||||
| @@ -568,9 +568,10 @@ | |||||
| $('#' + JobID+'-icon').removeClass().addClass(res.status) | $('#' + JobID+'-icon').removeClass().addClass(res.status) | ||||
| $('#' + JobID+ '-text').text(res.status) | $('#' + JobID+ '-text').text(res.status) | ||||
| if(res.status==="STOPPED"){ | if(res.status==="STOPPED"){ | ||||
| $('#model-debug-'+JobID).removeClass('blue').addClass('disabled').text("再次调试").css("margin","0") | |||||
| $('#model-debug-'+JobID).removeClass('disabled').addClass('blue').text("再次调试").css("margin","0") | |||||
| $('#model-image-'+JobID).removeClass('blue').addClass('disabled') | $('#model-image-'+JobID).removeClass('blue').addClass('disabled') | ||||
| $('#stop-model-debug-'+JobID).removeClass('blue').addClass('disabled') | $('#stop-model-debug-'+JobID).removeClass('blue').addClass('disabled') | ||||
| $('#model-delete-'+JobID).removeClass('disabled').addClass('blue') | |||||
| } | } | ||||
| else{ | else{ | ||||
| $('#model-debug-'+JobID).removeClass('blue').addClass('disabled') | $('#model-debug-'+JobID).removeClass('blue').addClass('disabled') | ||||