| @@ -283,30 +283,6 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| mkModelPath(modelPath) | mkModelPath(modelPath) | ||||
| uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/") | uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/") | ||||
| benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath | |||||
| if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { | |||||
| var gpuType string | |||||
| for _, gpuInfo := range gpuInfos.GpuInfo { | |||||
| if gpuInfo.Queue == gpuQueue { | |||||
| gpuType = gpuInfo.Value | |||||
| } | |||||
| } | |||||
| downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BenchmarkName, benchmarkPath, form.BenchmarkCategory, gpuType) | |||||
| uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/") | |||||
| } | |||||
| snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath | |||||
| if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { | |||||
| downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "") | |||||
| uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") | |||||
| } | |||||
| brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath | |||||
| if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { | |||||
| downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "") | |||||
| uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") | |||||
| } | |||||
| err = cloudbrain.GenerateTask(ctx, displayJobName, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), | err = cloudbrain.GenerateTask(ctx, displayJobName, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), | ||||
| storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), | storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), | ||||
| storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"), | storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"), | ||||
| @@ -1241,7 +1217,7 @@ func downloadCode(repo *models.Repository, codePath, branchName string) error { | |||||
| return nil | return nil | ||||
| } | } | ||||
| func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepoName, codePath, benchmarkCategory, gpuType string) error { | |||||
| func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepoName, codePath, benchmarkCategory, gpuType, userName string) error { | |||||
| err := os.MkdirAll(codePath, os.ModePerm) | err := os.MkdirAll(codePath, os.ModePerm) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("mkdir codePath failed", err.Error()) | log.Error("mkdir codePath failed", err.Error()) | ||||
| @@ -1269,7 +1245,7 @@ func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepo | |||||
| defer f.Close() | defer f.Close() | ||||
| data, err := json.Marshal(models.TaskInfo{ | data, err := json.Marshal(models.TaskInfo{ | ||||
| Username: repo.Owner.Name, | |||||
| Username: userName, | |||||
| TaskName: taskName, | TaskName: taskName, | ||||
| CodeName: repo.Name, | CodeName: repo.Name, | ||||
| BenchmarkCategory: strings.Split(benchmarkCategory, ","), | BenchmarkCategory: strings.Split(benchmarkCategory, ","), | ||||
| @@ -1970,7 +1946,7 @@ func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainFo | |||||
| } | } | ||||
| } | } | ||||
| if err := downloadRateCode(repo, jobName, childInfo.Owner, childInfo.RepoName, benchmarkPath, form.BenchmarkCategory, gpuType); err != nil { | |||||
| if err := downloadRateCode(repo, jobName, childInfo.Owner, childInfo.RepoName, benchmarkPath, form.BenchmarkCategory, gpuType, ctx.User.Name); err != nil { | |||||
| log.Error("downloadRateCode failed, %v", err, ctx.Data["MsgID"]) | log.Error("downloadRateCode failed, %v", err, ctx.Data["MsgID"]) | ||||
| //cloudBrainNewDataPrepare(ctx) | //cloudBrainNewDataPrepare(ctx) | ||||
| //ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) | //ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) | ||||
| @@ -2068,7 +2044,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) | |||||
| snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath | snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath | ||||
| if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { | if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { | ||||
| downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "") | |||||
| downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "", ctx.User.Name) | |||||
| uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") | uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") | ||||
| command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description)) | command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description)) | ||||
| @@ -2076,7 +2052,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) | |||||
| benchmarkChildTypeID := 0 | benchmarkChildTypeID := 0 | ||||
| brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath | brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath | ||||
| if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { | if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { | ||||
| downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "") | |||||
| downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "", ctx.User.Name) | |||||
| uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") | uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") | ||||
| benchmarkChildTypeID = form.BenchmarkChildTypeID | benchmarkChildTypeID = form.BenchmarkChildTypeID | ||||
| command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) | command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) | ||||