| @@ -27,6 +27,7 @@ const ( | |||
| JobTypeDebug JobType = "DEBUG" | |||
| JobTypeBenchmark JobType = "BENCHMARK" | |||
| JobTypeSnn4imagenet JobType = "SNN4IMAGENET" | |||
| JobTypeBrainScore JobType = "BRAINSCORE" | |||
| ModelArtsCreateQueue ModelArtsJobStatus = "CREATE_QUEUING" //免费资源创建排队中 | |||
| ModelArtsCreating ModelArtsJobStatus = "CREATING" //创建中 | |||
| @@ -16,6 +16,7 @@ const ( | |||
| ModelMountPath = "/model" | |||
| BenchMarkMountPath = "/benchmark" | |||
| Snn4imagenetMountPath = "/snn4imagenet" | |||
| BrainScoreMountPath = "/brainscore" | |||
| TaskInfoName = "/taskInfo" | |||
| SubTaskName = "task1" | |||
| @@ -457,6 +457,11 @@ var ( | |||
| Snn4imagenetCode string | |||
| Snn4imagenetServerHost string | |||
| //snn4imagenet config | |||
| IsBrainScoreEnabled bool | |||
| BrainScoreCode string | |||
| BrainScoreServerHost string | |||
| //blockchain config | |||
| BlockChainHost string | |||
| CommitValidDate string | |||
| @@ -1181,8 +1186,13 @@ func NewContext() { | |||
| sec = Cfg.Section("snn4imagenet") | |||
| IsSnn4imagenetEnabled = sec.Key("ENABLED").MustBool(false) | |||
| Snn4imagenetCode = sec.Key("SNN4IMAGENETCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git") | |||
| Snn4imagenetServerHost = sec.Key("HOST").MustString("http://192.168.202.90:3366/") | |||
| Snn4imagenetCode = sec.Key("SNN4IMAGENETCODE").MustString("https://yult:19910821ylt@git.openi.org.cn/yult/snn4imagenet_script.git") | |||
| Snn4imagenetServerHost = sec.Key("HOST").MustString("http://192.168.207.76:8080/") | |||
| sec = Cfg.Section("brainscore") | |||
| IsBrainScoreEnabled = sec.Key("ENABLED").MustBool(false) | |||
| BrainScoreCode = sec.Key("BRAINSCORECODE").MustString("https://yult:19910821ylt@git.openi.org.cn/yult/brainscore_script.git") | |||
| BrainScoreServerHost = sec.Key("HOST").MustString("http://192.168.207.76:8080/") | |||
| sec = Cfg.Section("blockchain") | |||
| BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/") | |||
| @@ -175,6 +175,9 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error{ | |||
| ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath | |||
| ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled | |||
| ctx.Data["brainscore_path"] = cloudbrain.BrainScoreMountPath | |||
| ctx.Data["is_brainscore_enabled"] = setting.IsBrainScoreEnabled | |||
| return nil | |||
| } | |||
| @@ -198,7 +201,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | |||
| resourceSpecId := form.ResourceSpecId | |||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) { | |||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) { | |||
| log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("jobtype error", tplCloudBrainNew, &form) | |||
| @@ -247,6 +250,11 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath, "", "") | |||
| } | |||
| brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath | |||
| if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { | |||
| downloadRateCode(repo, jobName, setting.BrainScoreCode, brainScorePath, "", "") | |||
| } | |||
| err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuQueue, resourceSpecId) | |||
| if err != nil { | |||
| cloudBrainNewDataPrepare(ctx) | |||
| @@ -568,6 +576,8 @@ func GetRate(ctx *context.Context) { | |||
| ctx.Redirect(setting.BenchmarkServerHost + "?username=" + ctx.User.Name) | |||
| } else if job.JobType == string(models.JobTypeSnn4imagenet) { | |||
| ctx.Redirect(setting.Snn4imagenetServerHost) | |||
| } else if job.JobType == string(models.JobTypeBrainScore) { | |||
| ctx.Redirect(setting.BrainScoreServerHost) | |||
| } else { | |||
| log.Error("JobType error:%s", job.JobType, ctx.Data["msgID"]) | |||
| } | |||
| @@ -89,6 +89,10 @@ | |||
| display: none; | |||
| } | |||
| .inline.required.field.cloudbrain_brainscore { | |||
| display: none; | |||
| } | |||
| .select2-container .select2-selection--single{ | |||
| height:38px !important; | |||
| } | |||
| @@ -130,12 +134,13 @@ | |||
| <input name="job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.job_name}}" tabindex="3" autofocus required maxlength="255"> | |||
| </div> | |||
| <div class="inline required field" style="{{if .is_benchmark_enabled}}display:block;{{else if .is_snn4imagenet_enabled}}display:block;{{else}}display:none;{{end}}"> | |||
| <div class="inline required field" style="{{if ((.is_benchmark_enabled) or (.is_snn4imagenet_enabled) or (.is_brainscore_enabled))}}display:block;{{else}}display:none;{{end}}"> | |||
| <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> | |||
| </select> | |||
| </div> | |||
| @@ -215,6 +220,10 @@ | |||
| <label>snn4imagenet脚本存放路径</label> | |||
| <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}" tabindex="3" 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"> | |||
| </div> | |||
| <div class="inline required field" hidden> | |||
| <label>启动命令</label> | |||
| <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea> | |||
| @@ -311,9 +320,12 @@ | |||
| $(".cloudbrain_benchmark").show(); | |||
| } else if ($(this).val() == 'SNN4IMAGENET') { | |||
| $(".cloudbrain_snn4imagenet").show(); | |||
| } else if ($(this).val() == 'BRAINSCORE') { | |||
| $(".cloudbrain_brainscore").show(); | |||
| } else { | |||
| $(".cloudbrain_benchmark").hide(); | |||
| $(".cloudbrain_snn4imagenet").hide(); | |||
| $(".cloudbrain_brainscore").hide(); | |||
| } | |||
| }) | |||
| }) | |||