Browse Source

benchmark opt

tags/V1.22.3.1^2
lewis 3 years ago
parent
commit
dc5da68d63
4 changed files with 30 additions and 9 deletions
  1. +8
    -5
      models/cloudbrain.go
  2. +19
    -1
      routers/repo/cloudbrain.go
  3. +2
    -2
      templates/explore/repo_orgtop.tmpl
  4. +1
    -1
      templates/repo/cloudbrain/benchmark/index.tmpl

+ 8
- 5
models/cloudbrain.go View File

@@ -144,8 +144,10 @@ type Cloudbrain struct {
CkptName string //权重文件名称
ResultUrl string //推理结果的obs路径

User *User `xorm:"-"`
Repo *Repository `xorm:"-"`
User *User `xorm:"-"`
Repo *Repository `xorm:"-"`
BenchmarkTypeName string `xorm:"-"`
BenchmarkTypeRankLink string `xorm:"-"`
}

type CloudbrainInfo struct {
@@ -407,9 +409,10 @@ type BenchmarkTypes struct {
}

type BenchmarkType struct {
Id int `json:"id"`
First string `json:"first"` //一级算法类型名称
Second []*BenchmarkDataset `json:"second"`
Id int `json:"id"`
RankLink string `json:"rank_link"`
First string `json:"first"` //一级算法类型名称
Second []*BenchmarkDataset `json:"second"`
}

type BenchmarkDataset struct {


+ 19
- 1
routers/repo/cloudbrain.go View File

@@ -404,10 +404,11 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
} else {
duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix)
}
if benchmarkTypes != nil {
if task.BenchmarkTypeID > 0 {
for _, benchmarkType := range benchmarkTypes.BenchmarkType {
if task.BenchmarkTypeID == benchmarkType.Id {
ctx.Data["BenchmarkTypeName"] = benchmarkType.First
ctx.Data["RankLink"] = benchmarkType.RankLink
for _, benchmarkChildType := range benchmarkType.Second {
if task.BenchmarkChildTypeID == benchmarkChildType.Id {
ctx.Data["BenchmarkChildTypeName"] = benchmarkChildType.Value
@@ -1051,6 +1052,13 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
return
}

if benchmarkTypes == nil {
if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil {
ctx.ServerError("Get BenchmarkTypes faild:", err)
return
}
}

for i, task := range ciTasks {
ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain)
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
@@ -1061,6 +1069,16 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
duration = int64(task.Cloudbrain.UpdatedUnix) - int64(task.Cloudbrain.CreatedUnix)
}
ciTasks[i].TrainJobDuration = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000)
ciTasks[i].BenchmarkTypeName = ""
if task.BenchmarkTypeID > 0 {
for _, benchmarkType := range benchmarkTypes.BenchmarkType {
if task.BenchmarkTypeID == benchmarkType.Id {
ciTasks[i].BenchmarkTypeRankLink = benchmarkType.RankLink
ciTasks[i].BenchmarkTypeName = benchmarkType.First
break
}
}
}
}

pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5)


+ 2
- 2
templates/explore/repo_orgtop.tmpl View File

@@ -53,8 +53,8 @@
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/JD_Group">
<img src="/img/org-jd@2x-80.jpg" alt="京东" title="京东">
<a class="image" href="https://git.openi.org.cn/JDOpenISCT">
<img src="/img/org-jd@2x-80.jpg" alt="京东智能供应链开源工具" title="京东智能供应链开源工具">
</a>
</div>
</div>


+ 1
- 1
templates/repo/cloudbrain/benchmark/index.tmpl View File

@@ -113,7 +113,7 @@
</span>
</div>
<div class="two wide column text center padding0">
<a class="ui basic button blue" href="https://git.openi.org.cn/benchmark/?username=admin&algType={{if eq .BenchmarkTypeID 1}}detection{{else if eq .BenchmarkTypeID 2}}reid{{else if eq .BenchmarkTypeID 3}}tracking{{end}}" target="_blank">
<a style="font-size: 12px;" href="{{.BenchmarkTypeRankLink}}" target="_blank">
{{.BenchmarkTypeName}}
</a>
</div>


Loading…
Cancel
Save