From a265a6561706d820cb92d0bea502c7a71bdb3847 Mon Sep 17 00:00:00 2001
From: lewis <747342561@qq.com>
Date: Tue, 26 Oct 2021 14:45:05 +0800
Subject: [PATCH 1/4] opt
---
templates/repo/cloudbrain/new.tmpl | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl
index ec4495bd7..b3b827558 100755
--- a/templates/repo/cloudbrain/new.tmpl
+++ b/templates/repo/cloudbrain/new.tmpl
@@ -138,9 +138,15 @@
@@ -214,15 +220,15 @@
-
+
-
+
-
+
From 779532f98d4b06875b81dd5b54ae25fe20211e45 Mon Sep 17 00:00:00 2001
From: lewis <747342561@qq.com>
Date: Tue, 26 Oct 2021 15:56:22 +0800
Subject: [PATCH 2/4] add taskinfo
---
modules/cloudbrain/cloudbrain.go | 9 ++++++++-
routers/repo/cloudbrain.go | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules/cloudbrain/cloudbrain.go b/modules/cloudbrain/cloudbrain.go
index e09aaf931..483292d2f 100755
--- a/modules/cloudbrain/cloudbrain.go
+++ b/modules/cloudbrain/cloudbrain.go
@@ -28,7 +28,7 @@ var (
ResourceSpecs *models.ResourceSpecs
)
-func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuQueue string, resourceSpecId int) error {
+func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, brainScorePath, jobType, gpuQueue string, resourceSpecId int) error {
dataActualPath := setting.Attachment.Minio.RealPath +
setting.Attachment.Minio.Bucket + "/" +
setting.Attachment.Minio.BasePath +
@@ -104,6 +104,13 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath,
ReadOnly: true,
},
},
+ {
+ HostPath: models.StHostPath{
+ Path: brainScorePath,
+ MountPath: BrainScoreMountPath,
+ ReadOnly: true,
+ },
+ },
},
})
if err != nil {
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index ccf2b879d..f0bb3a36f 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -262,7 +262,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
downloadRateCode(repo, jobName, setting.BrainScoreCode, brainScorePath, "", "")
}
- err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuQueue, resourceSpecId)
+ err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, brainScorePath, jobType, gpuQueue, resourceSpecId)
if err != nil {
cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form)
From c3698de73edb1346096188fc6af66ed34c71dcda Mon Sep 17 00:00:00 2001
From: ychao_1983
Date: Tue, 26 Oct 2021 15:56:29 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E6=8C=87=E6=A0=87=EF=BC=8C=E9=83=BD=E9=87=8D=E6=96=B0=E5=8A=A0?=
=?UTF-8?q?=E8=BD=BD=E6=8C=87=E6=A0=87=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
modules/setting/radarmap.go | 7 +++++++
modules/setting/setting.go | 6 +++++-
routers/repo/repo_statistic.go | 3 +++
3 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 modules/setting/radarmap.go
diff --git a/modules/setting/radarmap.go b/modules/setting/radarmap.go
new file mode 100644
index 000000000..26624d143
--- /dev/null
+++ b/modules/setting/radarmap.go
@@ -0,0 +1,7 @@
+package setting
+
+func UpdateRadarMap() {
+ Cfg.DeleteSection("radar_map")
+ Cfg.Reload()
+ SetRadarMapConfig()
+}
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 9dcd9a8ab..221933c6f 100755
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1270,7 +1270,11 @@ func NewContext() {
TimeField = sec.Key("TIMEFIELD").MustString(" @timestamptest")
ElkTimeFormat = sec.Key("ELKTIMEFORMAT").MustString("date_time")
- sec = Cfg.Section("radar_map")
+ SetRadarMapConfig()
+}
+
+func SetRadarMapConfig() {
+ sec := Cfg.Section("radar_map")
RadarMap.Impact = sec.Key("impact").MustFloat64(0.3)
RadarMap.ImpactWatch = sec.Key("impact_watch").MustFloat64(0.1)
diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go
index 7aec44787..4d23e79f2 100755
--- a/routers/repo/repo_statistic.go
+++ b/routers/repo/repo_statistic.go
@@ -3,6 +3,8 @@ package repo
import (
"time"
+ "code.gitea.io/gitea/modules/setting"
+
"code.gitea.io/gitea/modules/normalization"
"code.gitea.io/gitea/models"
@@ -14,6 +16,7 @@ import (
func RepoStatisticAuto() {
log.Info("", time.Now())
yesterday := time.Now().AddDate(0, 0, -1).Format("2006-01-02")
+ setting.UpdateRadarMap()
RepoStatisticDaily(yesterday)
}
From 56d4187392b5c9fe211fdaa03f12ec229f0e554e Mon Sep 17 00:00:00 2001
From: zhoupzh
Date: Tue, 26 Oct 2021 16:15:04 +0800
Subject: [PATCH 4/4] fix issue #593
---
templates/repo/modelarts/new.tmpl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/repo/modelarts/new.tmpl b/templates/repo/modelarts/new.tmpl
index da0b83059..79a31286f 100755
--- a/templates/repo/modelarts/new.tmpl
+++ b/templates/repo/modelarts/new.tmpl
@@ -179,11 +179,11 @@
let value_task = $("input[name='job_name']").val()
- let re = /^[a-z0-9][a-z0-9-_]{1,35}$/
+ let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
let flag = re.test(value_task)
if(!flag){
$('#messageInfo').css('display','block')
- let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。'
+ let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
$('#messageInfo p').text(str)
return false
}