From a6779a47edf892f7e8db2689d09bac2492439e68 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 21 Jan 2022 11:35:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/cloudbrain/benchmark/new.tmpl | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl index 4ad5cfd35..0f0ecbe44 100755 --- a/templates/repo/cloudbrain/benchmark/new.tmpl +++ b/templates/repo/cloudbrain/benchmark/new.tmpl @@ -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: [ From 81ef4ff092a261e1f3a7b04f3877df9923bd3f5f Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 21 Jan 2022 14:42:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 17 +++++++++++++- templates/repo/cloudbrain/benchmark/show.tmpl | 23 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 6621081fd..b84bc3626 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -400,6 +400,21 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { } else { duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) } + if benchmarkTypes.BenchmarkType != 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 +460,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" diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl index 329f31476..5fe3c02c3 100755 --- a/templates/repo/cloudbrain/benchmark/show.tmpl +++ b/templates/repo/cloudbrain/benchmark/show.tmpl @@ -277,7 +277,17 @@ td, th { - + + + 类型 + + + +
+ {{$.BenchmarkTypeName}} +
+ + @@ -346,6 +356,17 @@ td, th { + + + 子类型 + + + +
+ {{$.BenchmarkChildTypeName}} +
+ + From c0907b3df5dffd410c5f24faa6712c36f5a88f30 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 21 Jan 2022 14:46:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index b84bc3626..662719799 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -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,7 +405,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { } else { duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) } - if benchmarkTypes.BenchmarkType != nil { + if benchmarkTypes != nil { for _, benchmarkType := range benchmarkTypes.BenchmarkType { if task.BenchmarkTypeID == benchmarkType.Id { ctx.Data["BenchmarkTypeName"] = benchmarkType.First From 7065ff69f6d2218818a9664257b101c53164f983 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 21 Jan 2022 14:50:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/cloudbrain/benchmark/show.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl index 5fe3c02c3..99fd35de2 100755 --- a/templates/repo/cloudbrain/benchmark/show.tmpl +++ b/templates/repo/cloudbrain/benchmark/show.tmpl @@ -283,7 +283,7 @@ td, th { -
+
{{$.BenchmarkTypeName}}
@@ -362,7 +362,7 @@ td, th { -
+
{{$.BenchmarkChildTypeName}}