Browse Source

评测任务类型增加及修改。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 2 years ago
parent
commit
93085e41bd
5 changed files with 11 additions and 5 deletions
  1. +1
    -1
      models/cloudbrain.go
  2. +1
    -1
      routers/admin/cloudbrains.go
  3. +2
    -2
      routers/api/v1/repo/cloudbrain_dashboard.go
  4. +6
    -0
      routers/repo/aisafety.go
  5. +1
    -1
      routers/user/home.go

+ 1
- 1
models/cloudbrain.go View File

@@ -2027,7 +2027,7 @@ func GetCloudbrainRunCountByRepoID(repoID int64) (int, error) {
}

func GetBenchmarkCountByUserID(userID int64) (int, error) {
count, err := x.In("status", JobWaiting, JobRunning).And("(job_type = ? or job_type = ? or job_type = ?) and user_id = ? and type = ?", string(JobTypeBenchmark), string(JobTypeBrainScore), string(JobTypeSnn4imagenet), userID, TypeCloudBrainOne).Count(new(Cloudbrain))
count, err := x.In("status", JobWaiting, JobRunning).And("(job_type = ? or job_type = ? or job_type = ?) and user_id = ? and type = ?", string(JobTypeBenchmark), string(JobTypeModelSafety), string(JobTypeBrainScore), string(JobTypeSnn4imagenet), userID, TypeCloudBrainOne).Count(new(Cloudbrain))
return int(count), err
}



+ 1
- 1
routers/admin/cloudbrains.go View File

@@ -52,7 +52,7 @@ func CloudBrains(ctx *context.Context) {
var jobTypes []string
jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
} else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType)
}


+ 2
- 2
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -626,7 +626,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) {
}

jobTypeList := []string{string(models.JobTypeDebug), string(models.JobTypeTrain), string(models.JobTypeInference), string(models.JobTypeBenchmark),
string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)}
string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)}
for _, v := range jobTypeList {
if _, ok := cloudOneJobTypeRes[v]; !ok {
cloudOneJobTypeRes[v] = 0
@@ -709,7 +709,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
var jobTypes []string
jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
} else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType)
}


+ 6
- 0
routers/repo/aisafety.go View File

@@ -530,7 +530,12 @@ func AiSafetyCreateForGetGPU(ctx *context.Context) {
queuesDetail, _ := cloudbrain.GetQueuesDetail()
if queuesDetail != nil {
ctx.Data["QueuesDetail"] = queuesDetail
reqPara, _ := json.Marshal(queuesDetail)
log.Warn("The GPU WaitCount json:", string(reqPara))
} else {
log.Info("The GPU WaitCount not get")
}

ctx.HTML(200, tplModelSafetyTestCreateGpu)
}

@@ -573,6 +578,7 @@ func AiSafetyCreateForGetNPU(ctx *context.Context) {
prepareCloudbrainTwoInferenceSpecs(ctx)
waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "")
ctx.Data["WaitCount"] = waitCount
log.Info("The NPU WaitCount is " + fmt.Sprint(waitCount))
ctx.HTML(200, tplModelSafetyTestCreateNpu)
}



+ 1
- 1
routers/user/home.go View File

@@ -777,7 +777,7 @@ func Cloudbrains(ctx *context.Context) {
var jobTypes []string
jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
} else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType)
}


Loading…
Cancel
Save