| @@ -1061,6 +1061,11 @@ ENABLED = true | |||||
| BENCHMARKCODE = https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git | BENCHMARKCODE = https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git | ||||
| HOST = http://192.168.202.90:3366/ | HOST = http://192.168.202.90:3366/ | ||||
| [snn4imagenet] | |||||
| ENABLED = true | |||||
| SNN4IMAGENETCODE = https://yult:eh2Ten4iLYjFkbj@git.openi.org.cn/ylt/snn4imagenet.git | |||||
| HOST = http://192.168.202.90:3366/ | |||||
| [decompress] | [decompress] | ||||
| HOST = http://192.168.207.34:39987 | HOST = http://192.168.207.34:39987 | ||||
| USER = cW4cMtH24eoWPE7X | USER = cW4cMtH24eoWPE7X | ||||
| @@ -25,6 +25,7 @@ const ( | |||||
| JobTypeDebug JobType = "DEBUG" | JobTypeDebug JobType = "DEBUG" | ||||
| JobTypeBenchmark JobType = "BENCHMARK" | JobTypeBenchmark JobType = "BENCHMARK" | ||||
| JobTypeSnn4imagenet JobType = "SNN4IMAGENET" | |||||
| ModelArtsCreateQueue ModelArtsJobStatus = "CREATE_QUEUING" //免费资源创建排队中 | ModelArtsCreateQueue ModelArtsJobStatus = "CREATE_QUEUING" //免费资源创建排队中 | ||||
| ModelArtsCreating ModelArtsJobStatus = "CREATING" //创建中 | ModelArtsCreating ModelArtsJobStatus = "CREATING" //创建中 | ||||
| @@ -15,6 +15,7 @@ const ( | |||||
| DataSetMountPath = "/dataset" | DataSetMountPath = "/dataset" | ||||
| ModelMountPath = "/model" | ModelMountPath = "/model" | ||||
| BenchMarkMountPath = "/benchmark" | BenchMarkMountPath = "/benchmark" | ||||
| Snn4imagenetMountPath = "/snn4imagenet" | |||||
| TaskInfoName = "/taskInfo" | TaskInfoName = "/taskInfo" | ||||
| SubTaskName = "task1" | SubTaskName = "task1" | ||||
| @@ -22,7 +23,7 @@ const ( | |||||
| Success = "S000" | Success = "S000" | ||||
| ) | ) | ||||
| func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, jobType string) error { | |||||
| func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType string) 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 + | ||||
| @@ -78,6 +79,13 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||||
| ReadOnly: true, | ReadOnly: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| { | |||||
| HostPath: models.StHostPath{ | |||||
| Path: snn4imagenetPath, | |||||
| MountPath: Snn4imagenetMountPath, | |||||
| ReadOnly: true, | |||||
| }, | |||||
| }, | |||||
| }, | }, | ||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -444,6 +444,11 @@ var ( | |||||
| BenchmarkCode string | BenchmarkCode string | ||||
| BenchmarkServerHost string | BenchmarkServerHost string | ||||
| //snn4imagenet config | |||||
| IsSnn4imagenetEnabled bool | |||||
| Snn4imagenetCode string | |||||
| Snn4imagenetServerHost string | |||||
| //blockchain config | //blockchain config | ||||
| BlockChainHost string | BlockChainHost string | ||||
| CommitValidDate string | CommitValidDate string | ||||
| @@ -1146,6 +1151,11 @@ func NewContext() { | |||||
| BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git") | BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git") | ||||
| BenchmarkServerHost = sec.Key("HOST").MustString("http://192.168.202.90:3366/") | BenchmarkServerHost = sec.Key("HOST").MustString("http://192.168.202.90:3366/") | ||||
| 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/") | |||||
| sec = Cfg.Section("blockchain") | sec = Cfg.Section("blockchain") | ||||
| BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/") | BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/") | ||||
| CommitValidDate = sec.Key("COMMIT_VALID_DATE").MustString("2021-01-15") | CommitValidDate = sec.Key("COMMIT_VALID_DATE").MustString("2021-01-15") | ||||
| @@ -143,7 +143,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| jobType := form.JobType | jobType := form.JobType | ||||
| codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | ||||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) { | |||||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet){ | |||||
| log.Error("jobtype error:", jobType) | log.Error("jobtype error:", jobType) | ||||
| ctx.RenderWithErr("jobtype error", tplCloudBrainNew, &form) | ctx.RenderWithErr("jobtype error", tplCloudBrainNew, &form) | ||||
| return | return | ||||
| @@ -160,10 +160,15 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath | benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath | ||||
| if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { | if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { | ||||
| downloadBenchmarkCode(repo, jobName, benchmarkPath) | |||||
| downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath) | |||||
| } | } | ||||
| err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, jobType) | |||||
| snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath | |||||
| if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { | |||||
| downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath) | |||||
| } | |||||
| err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType) | |||||
| if err != nil { | if err != nil { | ||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ||||
| return | return | ||||
| @@ -324,14 +329,14 @@ func downloadCode(repo *models.Repository, codePath string) error { | |||||
| return nil | return nil | ||||
| } | } | ||||
| func downloadBenchmarkCode(repo *models.Repository, taskName string, benchmarkPath string) error { | |||||
| err := os.MkdirAll(benchmarkPath, os.ModePerm) | |||||
| func downloadRateCode(repo *models.Repository, taskName, gitPath, codePath string) error { | |||||
| err := os.MkdirAll(codePath, os.ModePerm) | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("mkdir benchmarkPath failed", err.Error()) | |||||
| log.Error("mkdir codePath failed", err.Error()) | |||||
| return err | return err | ||||
| } | } | ||||
| command := "git clone " + setting.BenchmarkCode + " " + benchmarkPath | |||||
| command := "git clone " + gitPath + " " + codePath | |||||
| cmd := exec.Command("/bin/bash", "-c", command) | cmd := exec.Command("/bin/bash", "-c", command) | ||||
| output, err := cmd.Output() | output, err := cmd.Output() | ||||
| log.Info(string(output)) | log.Info(string(output)) | ||||
| @@ -340,7 +345,7 @@ func downloadBenchmarkCode(repo *models.Repository, taskName string, benchmarkPa | |||||
| return err | return err | ||||
| } | } | ||||
| fileName := benchmarkPath + cloudbrain.TaskInfoName | |||||
| fileName := codePath + cloudbrain.TaskInfoName | |||||
| f, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) | f, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("OpenFile failed", err.Error()) | log.Error("OpenFile failed", err.Error()) | ||||
| @@ -529,7 +529,6 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
| m.Get("/get_multipart_url", repo.GetMultipartUploadUrl) | m.Get("/get_multipart_url", repo.GetMultipartUploadUrl) | ||||
| m.Post("/complete_multipart", repo.CompleteMultipart) | m.Post("/complete_multipart", repo.CompleteMultipart) | ||||
| m.Post("/update_chunk", repo.UpdateMultipart) | m.Post("/update_chunk", repo.UpdateMultipart) | ||||
| m.Get("/get_obs_key", repo.GetObsKey) | |||||
| }, reqSignIn) | }, reqSignIn) | ||||
| m.Group("/attachments", func() { | m.Group("/attachments", func() { | ||||
| @@ -117,6 +117,7 @@ | |||||
| <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="BENCHMARK">BENCHMARK</option> | ||||
| <option name="job_type" value="SNN4IMAGENET">SNN4IMAGENET</option> | |||||
| </select> | </select> | ||||
| </div> | </div> | ||||