|
|
@@ -134,6 +134,9 @@ func CloudBrainNew(ctx *context.Context) { |
|
|
|
var categories *models.Categories |
|
|
|
json.Unmarshal([]byte(setting.BenchmarkCategory), &categories) |
|
|
|
ctx.Data["benchmark_categories"] = categories.Category |
|
|
|
var gpuTypes *models.GpuTypes |
|
|
|
json.Unmarshal([]byte(setting.GpuTypes), &gpuTypes) |
|
|
|
ctx.Data["gpu_types"] = gpuTypes.GpuType |
|
|
|
ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath |
|
|
|
ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled |
|
|
|
ctx.HTML(200, tplCloudBrainNew) |
|
|
@@ -146,6 +149,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
|
command := form.Command |
|
|
|
uuid := form.Attachment |
|
|
|
jobType := form.JobType |
|
|
|
gpuType := setting.JobType |
|
|
|
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath |
|
|
|
|
|
|
|
if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) { |
|
|
@@ -165,6 +169,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
|
|
|
|
|
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath |
|
|
|
if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { |
|
|
|
gpuType = form.GpuType |
|
|
|
downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath, form.BenchmarkCategory) |
|
|
|
} |
|
|
|
|
|
|
@@ -173,7 +178,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
|
downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath, "") |
|
|
|
} |
|
|
|
|
|
|
|
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType) |
|
|
|
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuType) |
|
|
|
if err != nil { |
|
|
|
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) |
|
|
|
return |
|
|
|