@@ -429,7 +429,7 @@ func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) { | |||
func getModelArtsUserAttachments(e Engine, userID int64) ([]*AttachmentUsername, error) { | |||
attachments := make([]*AttachmentUsername, 0, 10) | |||
if err := e.Table("attachment").Join("LEFT", "`user`", "attachment.uploader_id "+ | |||
"= `user`.id").Where("attachment.type = ? and (uploader_id= ? or is_private = ?)", TypeCloudBrainTwo, userID, false).Find(&attachments); err != nil { | |||
"= `user`.id").Where("attachment.type = ? and (uploader_id= ? or is_private = ?) and attachment.decompress_state = ?", TypeCloudBrainTwo, userID, false, DecompressStateDone).Find(&attachments); err != nil { | |||
return nil, err | |||
} | |||
return attachments, nil | |||
@@ -19,6 +19,9 @@ type JobType string | |||
type ModelArtsJobStatus string | |||
const ( | |||
NPUResource = "NPU" | |||
GPUResource = "CPU/GPU" | |||
JobWaiting CloudbrainStatus = "WAITING" | |||
JobStopped CloudbrainStatus = "STOPPED" | |||
JobSucceeded CloudbrainStatus = "SUCCEEDED" | |||
@@ -105,7 +108,7 @@ type Cloudbrain struct { | |||
IsLatestVersion string //是否是最新版本,1是,0否 | |||
CommitID string //提交的仓库代码id | |||
PreVersionName string //父版本名称 | |||
ComputeResource string `xorm:"-"` //计算资源,例如npu | |||
ComputeResource string //计算资源,例如npu | |||
EngineID int64 //引擎id | |||
TrainUrl string //输出的obs路径 | |||
@@ -212,6 +212,7 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||
Image: image, | |||
GpuQueue: gpuQueue, | |||
ResourceSpecId: resourceSpecId, | |||
ComputeResource: models.GPUResource, | |||
}) | |||
if err != nil { | |||
@@ -48,12 +48,8 @@ const ( | |||
PerPage = 10 | |||
IsLatestVersion = "1" | |||
NotLatestVersion = "0" | |||
// ComputeResource = "NPU" | |||
NPUResource = "NPU" | |||
GPUResource = "CPU/GPU" | |||
AllResource = "all" | |||
DebugType = -1 | |||
VersionCount = 1 | |||
DebugType = -1 | |||
VersionCount = 1 | |||
SortByCreateTime = "create_time" | |||
ConfigTypeCustom = "custom" | |||
@@ -215,14 +211,15 @@ func GenerateTask(ctx *context.Context, jobName, uuid, description, flavor strin | |||
} | |||
err = models.CreateCloudbrain(&models.Cloudbrain{ | |||
Status: string(models.JobWaiting), | |||
UserID: ctx.User.ID, | |||
RepoID: ctx.Repo.Repository.ID, | |||
JobID: jobResult.ID, | |||
JobName: jobName, | |||
JobType: string(models.JobTypeDebug), | |||
Type: models.TypeCloudBrainTwo, | |||
Uuid: uuid, | |||
Status: string(models.JobWaiting), | |||
UserID: ctx.User.ID, | |||
RepoID: ctx.Repo.Repository.ID, | |||
JobID: jobResult.ID, | |||
JobName: jobName, | |||
JobType: string(models.JobTypeDebug), | |||
Type: models.TypeCloudBrainTwo, | |||
Uuid: uuid, | |||
ComputeResource: models.NPUResource, | |||
}) | |||
if err != nil { | |||
@@ -277,7 +274,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||
DatasetName: attach.Name, | |||
CommitID: req.CommitID, | |||
IsLatestVersion: req.IsLatestVersion, | |||
//ComputeResource: NPUResource, | |||
ComputeResource: models.NPUResource, | |||
EngineID: req.EngineID, | |||
TrainUrl: req.TrainUrl, | |||
BranchName: req.BranchName, | |||
@@ -360,7 +357,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job | |||
CommitID: req.CommitID, | |||
IsLatestVersion: req.IsLatestVersion, | |||
PreVersionName: req.PreVersionName, | |||
ComputeResource: NPUResource, | |||
ComputeResource: models.GPUResource, | |||
EngineID: req.EngineID, | |||
TrainUrl: req.TrainUrl, | |||
BranchName: req.BranchName, | |||
@@ -21,7 +21,8 @@ type Fields struct { | |||
Format string `json:"format"` | |||
} | |||
type MatchPhrase struct { | |||
Message string `json:"message"` | |||
Message string `json:"message,omitempty"` | |||
TagName string `json:"tagName.keyword,omitempty"` | |||
} | |||
type Should struct { | |||
MatchPhrase MatchPhrase `json:"match_phrase"` | |||
@@ -144,7 +145,7 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje | |||
inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) | |||
inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = setting.TimeField | |||
inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = setting.ElkTimeFormat | |||
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) | |||
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 4) | |||
//限定查询时间 | |||
var timeRange Range | |||
timeRange.Timestamptest.Gte = Gte | |||
@@ -159,6 +160,24 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje | |||
var projectName FilterMatchPhrase | |||
projectName.ProjectName = Project | |||
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName | |||
//限定页面 | |||
var bool Bool | |||
bool.Should = make([]Should, 14) | |||
bool.Should[0].MatchPhrase.TagName = "%{[request][3]}" | |||
bool.Should[1].MatchPhrase.TagName = "datasets?type=0" | |||
bool.Should[2].MatchPhrase.TagName = "datasets?type=1" | |||
bool.Should[3].MatchPhrase.TagName = "issues" | |||
bool.Should[4].MatchPhrase.TagName = "labels" | |||
bool.Should[5].MatchPhrase.TagName = "pulls" | |||
bool.Should[6].MatchPhrase.TagName = "wiki" | |||
bool.Should[7].MatchPhrase.TagName = "activity" | |||
bool.Should[8].MatchPhrase.TagName = "cloudbrain" | |||
bool.Should[9].MatchPhrase.TagName = "modelarts" | |||
bool.Should[10].MatchPhrase.TagName = "blockchain" | |||
bool.Should[11].MatchPhrase.TagName = "watchers" | |||
bool.Should[12].MatchPhrase.TagName = "stars" | |||
bool.Should[13].MatchPhrase.TagName = "forks" | |||
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[3].Bool = &bool | |||
return inputStruct | |||
} | |||
@@ -245,7 +245,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | |||
return | |||
} | |||
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") | |||
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") | |||
} | |||
func CloudBrainRestart(ctx *context.Context) { | |||
@@ -568,7 +568,7 @@ func CloudBrainDel(ctx *context.Context) { | |||
} | |||
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) { | |||
@@ -51,11 +51,11 @@ func DebugJobIndex(ctx *context.Context) { | |||
} | |||
debugType := modelarts.DebugType | |||
jobType := string(models.JobTypeDebug) | |||
if debugListType == modelarts.GPUResource { | |||
if debugListType == models.GPUResource { | |||
debugType = models.TypeCloudBrainOne | |||
jobType = "" | |||
} | |||
if debugListType == modelarts.NPUResource { | |||
if debugListType == models.NPUResource { | |||
debugType = models.TypeCloudBrainTwo | |||
} | |||
@@ -76,16 +76,10 @@ func DebugJobIndex(ctx *context.Context) { | |||
for i, task := range ciTasks { | |||
ciTasks[i].CanDebug = cloudbrain.CanCreateOrDebugJob(ctx) | |||
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.SetDefaultParams(ctx) | |||
pager.AddParam(ctx, "debugListType", "ListType") | |||
ctx.Data["Page"] = pager | |||
ctx.Data["PageIsCloudBrain"] = true | |||
@@ -345,7 +339,7 @@ func NotebookDel(ctx *context.Context) { | |||
return | |||
} | |||
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") | |||
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") | |||
} | |||
func TrainJobIndex(ctx *context.Context) { | |||
@@ -375,7 +369,7 @@ func TrainJobIndex(ctx *context.Context) { | |||
for i, task := range tasks { | |||
tasks[i].CanDel = cloudbrain.CanDeleteJob(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) | |||
@@ -568,9 +568,10 @@ | |||
$('#' + JobID+'-icon').removeClass().addClass(res.status) | |||
$('#' + JobID+ '-text').text(res.status) | |||
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') | |||
$('#stop-model-debug-'+JobID).removeClass('blue').addClass('disabled') | |||
$('#model-delete-'+JobID).removeClass('disabled').addClass('blue') | |||
} | |||
else{ | |||
$('#model-debug-'+JobID).removeClass('blue').addClass('disabled') | |||