Browse Source

Merge pull request '解决:#1422及#1423' (#1427) from benchmark into V20220125

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1427
Reviewed-by: lewis <747342561@qq.com>
tags/v1.22.1.3
lewis 3 years ago
parent
commit
034f4241f5
3 changed files with 43 additions and 12 deletions
  1. +21
    -1
      routers/repo/cloudbrain.go
  2. +0
    -10
      templates/repo/cloudbrain/benchmark/new.tmpl
  3. +22
    -1
      templates/repo/cloudbrain/benchmark/show.tmpl

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

@@ -336,6 +336,11 @@ func CloudBrainRestart(ctx *context.Context) {
}

func CloudBrainBenchMarkShow(ctx *context.Context) {
if benchmarkTypes == nil {
if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil {
log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"])
}
}
cloudBrainShow(ctx, tplCloudBrainBenchmarkShow)
}

@@ -400,6 +405,21 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
} else {
duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix)
}
if benchmarkTypes != nil {
for _, benchmarkType := range benchmarkTypes.BenchmarkType {
if task.BenchmarkTypeID == benchmarkType.Id {
ctx.Data["BenchmarkTypeName"] = benchmarkType.First
for _, benchmarkChildType := range benchmarkType.Second {
if task.BenchmarkChildTypeID == benchmarkChildType.Id {
ctx.Data["BenchmarkChildTypeName"] = benchmarkChildType.Value
break
}
}
break
}
}
}

ctx.Data["duration"] = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000)
ctx.Data["task"] = task
ctx.Data["jobID"] = jobID
@@ -445,7 +465,7 @@ func CloudBrainStop(ctx *context.Context) {

task := ctx.Cloudbrain
for {
if task.Status == string(models.JobStopped) || task.Status == string(models.JobFailed) || task.Status == string(models.JobSucceeded){
if task.Status == string(models.JobStopped) || task.Status == string(models.JobFailed) || task.Status == string(models.JobSucceeded) {
log.Error("the job(%s) has been stopped", task.JobName, ctx.Data["msgID"])
resultCode = "-1"
errorMsg = "system error"


+ 0
- 10
templates/repo/cloudbrain/benchmark/new.tmpl View File

@@ -205,16 +205,6 @@
on: 'blur',
inline:true,
fields: {
job_name:{
identifier : 'job_name',
rules: [
{
type: 'regExp[/^[a-zA-Z0-9-_]{1,36}$/]',
prompt : '只包含大小写字母、数字、_和-,最长36个字符。'
}
]
},
image:{
identifier : 'image',
rules: [


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

@@ -277,7 +277,17 @@ td, th {
</div>
</td>
</tr>

<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
类型
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-BenchmarkTypeName">
{{$.BenchmarkTypeName}}
</div>
</td>
</tr>
</tbody>
@@ -346,6 +356,17 @@ td, th {
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
子类型
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-BenchmarkChildTypeName">
{{$.BenchmarkChildTypeName}}
</div>
</td>
</tr>
</tbody>
</table>
</div>


Loading…
Cancel
Save