Browse Source

Merge branch 'benchmark' of https://git.openi.org.cn/OpenI/aiforge into benchmark

pull/1405/head
zouap 3 years ago
parent
commit
1e6eee4046
9 changed files with 35 additions and 23 deletions
  1. +1
    -0
      models/action.go
  2. +6
    -6
      models/cloudbrain.go
  3. +1
    -1
      models/user_business_analysis.go
  4. +3
    -1
      modules/modelarts/modelarts.go
  5. +3
    -1
      routers/api/v1/repo/modelarts.go
  6. +5
    -2
      routers/repo/cloudbrain.go
  7. +14
    -7
      routers/repo/modelarts.go
  8. +1
    -1
      routers/repo/user_data_analysis.go
  9. +1
    -4
      web_src/js/components/UserAnalysis.vue

+ 1
- 0
models/action.go View File

@@ -350,6 +350,7 @@ func GetLast20PublicFeeds(opTypes []int) ([]*Action, error) {
cond := builder.NewCond()
cond = cond.And(builder.Eq{"is_private": false})
cond = cond.And(builder.Eq{"is_deleted": false})
cond = cond.And(builder.Expr("user_id=act_user_id"))
cond = cond.And(builder.In("op_type", opTypes))

actions := make([]*Action, 0, 20)


+ 6
- 6
models/cloudbrain.go View File

@@ -208,7 +208,7 @@ type CloudbrainsOptions struct {
CloudbrainIDs []int64
// JobStatus CloudbrainStatus
Type int
JobType string
JobTypes []string
VersionName string
IsLatestVersion string
JobTypeNot bool
@@ -911,14 +911,14 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
)
}

if (opts.JobType) != "" {
if len(opts.JobTypes) > 0 {
if opts.JobTypeNot {
cond = cond.And(
builder.Neq{"cloudbrain.job_type": opts.JobType},
builder.NotIn("cloudbrain.job_type", opts.JobTypes),
)
} else {
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(
builder.Eq{"cloudbrain.job_type": opts.JobType},
builder.In("cloudbrain.job_type", opts.JobTypes),
)
}



+ 1
- 1
models/user_business_analysis.go View File

@@ -387,7 +387,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, CommitCodeSizeMap map[s

OpenIIndexMap := queryUserRepoOpenIIndex(startTime.Unix(), end_unix)

DataDate := currentTimeNow.Format("2006-01-02")
DataDate := currentTimeNow.Format("2006-01-02") + " 00:01"

cond := "type != 1 and is_active=true"
count, err := sess.Where(cond).Count(new(User))


+ 3
- 1
modules/modelarts/modelarts.go View File

@@ -329,11 +329,13 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job
return err
}

var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeTrain))
repo := ctx.Repo.Repository
VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{
RepoID: repo.ID,
Type: models.TypeCloudBrainTwo,
JobType: string(models.JobTypeTrain),
JobTypes: jobTypes,
JobID: strconv.FormatInt(jobResult.JobID, 10),
})
if err != nil {


+ 3
- 1
routers/api/v1/repo/modelarts.go View File

@@ -223,10 +223,12 @@ func DelTrainJobVersion(ctx *context.APIContext) {

//获取删除后的版本数量
repo := ctx.Repo.Repository
var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeTrain))
VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{
RepoID: repo.ID,
Type: models.TypeCloudBrainTwo,
JobType: string(models.JobTypeTrain),
JobTypes: jobTypes,
JobID: jobID,
})
if err != nil {


+ 5
- 2
routers/repo/cloudbrain.go View File

@@ -32,6 +32,7 @@ const (
tplCloudBrainShow base.TplName = "repo/cloudbrain/show"
tplCloudBrainShowModels base.TplName = "repo/cloudbrain/models/index"

tplCloudBrainBenchmarkIndex base.TplName = "repo/cloudbrain/benchmark/index"
tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new"
)

@@ -942,6 +943,8 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
page = 1
}

var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeBenchmark))
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{
Page: page,
@@ -949,7 +952,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
},
RepoID: repo.ID,
Type: models.TypeCloudBrainOne,
JobType: string(models.JobTypeBenchmark),
JobTypes: jobTypes,
})
if err != nil {
ctx.ServerError("Get debugjob faild:", err)
@@ -968,7 +971,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
ctx.Data["Tasks"] = ciTasks
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx)
ctx.Data["RepoIsEmpty"] = repo.IsEmpty
ctx.HTML(200, tplBenchMarkIndex)
ctx.HTML(200, tplCloudBrainBenchmarkIndex)
}

func CloudBrainBenchmarkNew(ctx *context.Context) {


+ 14
- 7
routers/repo/modelarts.go View File

@@ -37,8 +37,6 @@ const (
tplModelArtsTrainJobNew base.TplName = "repo/modelarts/trainjob/new"
tplModelArtsTrainJobShow base.TplName = "repo/modelarts/trainjob/show"
tplModelArtsTrainJobVersionNew base.TplName = "repo/modelarts/trainjob/version_new"

tplBenchMarkIndex base.TplName = "repo/cloudbrain/benchmark/index"
)

func DebugJobIndex(ctx *context.Context) {
@@ -57,6 +55,8 @@ func DebugJobIndex(ctx *context.Context) {
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{
ListOptions: models.ListOptions{
Page: page,
@@ -64,8 +64,8 @@ func DebugJobIndex(ctx *context.Context) {
},
RepoID: repo.ID,
Type: debugType,
JobTypeNot: true,
JobType: string(models.JobTypeTrain),
JobTypeNot: false,
JobTypes: jobTypes,
})
if err != nil {
ctx.ServerError("Get debugjob faild:", err)
@@ -369,6 +369,8 @@ func TrainJobIndex(ctx *context.Context) {
page = 1
}

var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeTrain))
tasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{
Page: page,
@@ -377,7 +379,7 @@ func TrainJobIndex(ctx *context.Context) {
RepoID: repo.ID,
Type: models.TypeCloudBrainTwo,
JobTypeNot: false,
JobType: string(models.JobTypeTrain),
JobTypes: jobTypes,
IsLatestVersion: modelarts.IsLatestVersion,
})
if err != nil {
@@ -1275,6 +1277,9 @@ func TrainJobShow(ctx *context.Context) {
if page <= 0 {
page = 1
}

var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeTrain))
VersionListTasks, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{
Page: page,
@@ -1282,7 +1287,7 @@ func TrainJobShow(ctx *context.Context) {
},
RepoID: repo.ID,
Type: models.TypeCloudBrainTwo,
JobType: string(models.JobTypeTrain),
JobTypes: jobTypes,
JobID: jobID,
})

@@ -1394,10 +1399,12 @@ func TrainJobDel(ctx *context.Context) {
var jobID = ctx.Params(":jobid")
repo := ctx.Repo.Repository

var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeTrain))
VersionListTasks, _, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{
RepoID: repo.ID,
Type: models.TypeCloudBrainTwo,
JobType: string(models.JobTypeTrain),
JobTypes: jobTypes,
JobID: jobID,
})
if err != nil {


+ 1
- 1
routers/repo/user_data_analysis.go View File

@@ -88,7 +88,7 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac
xlsx.SetCellValue(sheetName, "P"+rows, formatTime[0:len(formatTime)-3])

formatTime = userRecord.DataDate
xlsx.SetCellValue(sheetName, "Q"+rows, formatTime+" 00:01")
xlsx.SetCellValue(sheetName, "Q"+rows, formatTime)
}

//设置默认打开的表单


+ 1
- 4
web_src/js/components/UserAnalysis.vue View File

@@ -135,13 +135,10 @@
</template>
</el-table-column>
<el-table-column
prop="CountDate"
prop="DataDate"
label="系统统计时间"
width="120px"
align="center">
<template slot-scope="scope">
{{scope.row.CountDate | transformTimestamp}}
</template>
</el-table-column>
</el-table>
</div>


Loading…
Cancel
Save