@@ -28,7 +28,7 @@ var ( | |||||
ResourceSpecs *models.ResourceSpecs | 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 + | dataActualPath := setting.Attachment.Minio.RealPath + | ||||
setting.Attachment.Minio.Bucket + "/" + | setting.Attachment.Minio.Bucket + "/" + | ||||
setting.Attachment.Minio.BasePath + | setting.Attachment.Minio.BasePath + | ||||
@@ -104,6 +104,13 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||||
ReadOnly: true, | ReadOnly: true, | ||||
}, | }, | ||||
}, | }, | ||||
{ | |||||
HostPath: models.StHostPath{ | |||||
Path: brainScorePath, | |||||
MountPath: BrainScoreMountPath, | |||||
ReadOnly: true, | |||||
}, | |||||
}, | |||||
}, | }, | ||||
}) | }) | ||||
if err != nil { | if err != nil { | ||||
@@ -0,0 +1,7 @@ | |||||
package setting | |||||
func UpdateRadarMap() { | |||||
Cfg.DeleteSection("radar_map") | |||||
Cfg.Reload() | |||||
SetRadarMapConfig() | |||||
} |
@@ -1270,7 +1270,11 @@ func NewContext() { | |||||
TimeField = sec.Key("TIMEFIELD").MustString(" @timestamptest") | TimeField = sec.Key("TIMEFIELD").MustString(" @timestamptest") | ||||
ElkTimeFormat = sec.Key("ELKTIMEFORMAT").MustString("date_time") | 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.Impact = sec.Key("impact").MustFloat64(0.3) | ||||
RadarMap.ImpactWatch = sec.Key("impact_watch").MustFloat64(0.1) | RadarMap.ImpactWatch = sec.Key("impact_watch").MustFloat64(0.1) | ||||
@@ -262,7 +262,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
downloadRateCode(repo, jobName, setting.BrainScoreCode, brainScorePath, "", "") | 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 { | if err != nil { | ||||
cloudBrainNewDataPrepare(ctx) | cloudBrainNewDataPrepare(ctx) | ||||
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ||||
@@ -3,6 +3,8 @@ package repo | |||||
import ( | import ( | ||||
"time" | "time" | ||||
"code.gitea.io/gitea/modules/setting" | |||||
"code.gitea.io/gitea/modules/normalization" | "code.gitea.io/gitea/modules/normalization" | ||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
@@ -14,6 +16,7 @@ import ( | |||||
func RepoStatisticAuto() { | func RepoStatisticAuto() { | ||||
log.Info("", time.Now()) | log.Info("", time.Now()) | ||||
yesterday := time.Now().AddDate(0, 0, -1).Format("2006-01-02") | yesterday := time.Now().AddDate(0, 0, -1).Format("2006-01-02") | ||||
setting.UpdateRadarMap() | |||||
RepoStatisticDaily(yesterday) | RepoStatisticDaily(yesterday) | ||||
} | } | ||||
@@ -138,9 +138,15 @@ | |||||
<label>任务类型</label> | <label>任务类型</label> | ||||
<select id="cloudbrain_job_type" class="ui search dropdown" placeholder="选择任务类型" style='width:385px' name="job_type"> | <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="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> | </select> | ||||
</div> | </div> | ||||
@@ -214,15 +220,15 @@ | |||||
</div> | </div> | ||||
<div class="inline required field cloudbrain_benchmark"> | <div class="inline required field cloudbrain_benchmark"> | ||||
<label>benchmark脚本存放路径</label> | <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> | ||||
<div class="inline required field cloudbrain_snn4imagenet"> | <div class="inline required field cloudbrain_snn4imagenet"> | ||||
<label>snn4imagenet脚本存放路径</label> | <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> | ||||
<div class="inline required field cloudbrain_brainscore"> | <div class="inline required field cloudbrain_brainscore"> | ||||
<label>brainscore脚本存放路径</label> | <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> | ||||
<div class="inline required field" hidden> | <div class="inline required field" hidden> | ||||
<label>启动命令</label> | <label>启动命令</label> | ||||
@@ -179,11 +179,11 @@ | |||||
let value_task = $("input[name='job_name']").val() | 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) | let flag = re.test(value_task) | ||||
if(!flag){ | if(!flag){ | ||||
$('#messageInfo').css('display','block') | $('#messageInfo').css('display','block') | ||||
let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。' | |||||
let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。' | |||||
$('#messageInfo p').text(str) | $('#messageInfo p').text(str) | ||||
return false | return false | ||||
} | } | ||||