|
|
@@ -108,7 +108,6 @@ func CloudBrainNew(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
for i, payload := range resultPublic.Payload.ImageInfo { |
|
|
|
log.Info(resultPublic.Payload.ImageInfo[i].Place) |
|
|
|
if strings.HasPrefix(resultPublic.Payload.ImageInfo[i].Place, "192.168") { |
|
|
|
resultPublic.Payload.ImageInfo[i].PlaceView = payload.Place[strings.Index(payload.Place, "/"):len(payload.Place)] |
|
|
|
} else { |
|
|
@@ -131,6 +130,10 @@ func CloudBrainNew(ctx *context.Context) { |
|
|
|
ctx.Data["model_path"] = cloudbrain.ModelMountPath |
|
|
|
ctx.Data["benchmark_path"] = cloudbrain.BenchMarkMountPath |
|
|
|
ctx.Data["is_benchmark_enabled"] = setting.IsBenchmarkEnabled |
|
|
|
|
|
|
|
var categories *models.Categories |
|
|
|
json.Unmarshal([]byte(setting.BenchmarkCategory), &categories) |
|
|
|
ctx.Data["benchmark_categories"] = categories.Category |
|
|
|
ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath |
|
|
|
ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled |
|
|
|
ctx.HTML(200, tplCloudBrainNew) |
|
|
@@ -162,12 +165,12 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
|
|
|
|
|
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath |
|
|
|
if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { |
|
|
|
downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath) |
|
|
|
downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath, form.BenchmarkCategory) |
|
|
|
} |
|
|
|
|
|
|
|
snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath |
|
|
|
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { |
|
|
|
downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath) |
|
|
|
downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath, "") |
|
|
|
} |
|
|
|
|
|
|
|
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType) |
|
|
@@ -337,7 +340,7 @@ func downloadCode(repo *models.Repository, codePath string) error { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
func downloadRateCode(repo *models.Repository, taskName, gitPath, codePath string) error { |
|
|
|
func downloadRateCode(repo *models.Repository, taskName, gitPath, codePath, benchmarkCategory string) error { |
|
|
|
err := os.MkdirAll(codePath, os.ModePerm) |
|
|
|
if err != nil { |
|
|
|
log.Error("mkdir codePath failed", err.Error()) |
|
|
@@ -366,6 +369,7 @@ func downloadRateCode(repo *models.Repository, taskName, gitPath, codePath strin |
|
|
|
Username: repo.Owner.Name, |
|
|
|
TaskName: taskName, |
|
|
|
CodeName: repo.Name, |
|
|
|
BenchmarkCategory: benchmarkCategory, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
log.Error("json.Marshal failed", err.Error()) |
|
|
|