Browse Source

Merge remote-tracking branch 'origin/V20211101' into zouap

pull/619/head
zouap 3 years ago
parent
commit
0a0ec20804
7 changed files with 38 additions and 11 deletions
  1. +8
    -1
      modules/cloudbrain/cloudbrain.go
  2. +7
    -0
      modules/setting/radarmap.go
  3. +5
    -1
      modules/setting/setting.go
  4. +1
    -1
      routers/repo/cloudbrain.go
  5. +3
    -0
      routers/repo/repo_statistic.go
  6. +12
    -6
      templates/repo/cloudbrain/new.tmpl
  7. +2
    -2
      templates/repo/modelarts/new.tmpl

+ 8
- 1
modules/cloudbrain/cloudbrain.go View File

@@ -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 {


+ 7
- 0
modules/setting/radarmap.go View File

@@ -0,0 +1,7 @@
package setting

func UpdateRadarMap() {
Cfg.DeleteSection("radar_map")
Cfg.Reload()
SetRadarMapConfig()
}

+ 5
- 1
modules/setting/setting.go View File

@@ -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)


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

@@ -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)


+ 3
- 0
routers/repo/repo_statistic.go View File

@@ -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)
}



+ 12
- 6
templates/repo/cloudbrain/new.tmpl View File

@@ -138,9 +138,15 @@
<label>任务类型</label>
<select id="cloudbrain_job_type" class="ui search dropdown" placeholder="选择任务类型" style='width:385px' name="job_type">
<option name="job_type" value="DEBUG">DEBUG</option>
<option name="job_type" value="BENCHMARK">BENCHMARK</option>
<option name="job_type" value="SNN4IMAGENET">SNN4IMAGENET</option>
<option name="job_type" value="BRAINSCORE">BRAINSCORE</option>
{{if .is_benchmark_enabled}}
<option name="job_type" value="BENCHMARK">BENCHMARK</option>
{{end}}
{{if .is_snn4imagenet_enabled}}
<option name="job_type" value="SNN4IMAGENET">SNN4IMAGENET</option>
{{end}}
{{if .is_brainscore_enabled}}
<option name="job_type" value="BRAINSCORE">BRAINSCORE</option>
{{end}}
</select>
</div>

@@ -214,15 +220,15 @@
</div>
<div class="inline required field cloudbrain_benchmark">
<label>benchmark脚本存放路径</label>
<input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
<input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
</div>
<div class="inline required field cloudbrain_snn4imagenet">
<label>snn4imagenet脚本存放路径</label>
<input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
<input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
</div>
<div class="inline required field cloudbrain_brainscore">
<label>brainscore脚本存放路径</label>
<input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
<input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
</div>
<div class="inline required field" hidden>
<label>启动命令</label>


+ 2
- 2
templates/repo/modelarts/new.tmpl View File

@@ -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
}


Loading…
Cancel
Save