|
|
@@ -2066,19 +2066,23 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) |
|
|
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, "", "") |
|
|
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") |
|
|
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") |
|
|
} |
|
|
|
|
|
|
|
|
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description)) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
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, "", "") |
|
|
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") |
|
|
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") |
|
|
|
|
|
benchmarkChildTypeID = form.BenchmarkChildTypeID |
|
|
|
|
|
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
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+"/"), |
|
|
storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"), jobType, gpuQueue, form.Description, branchName, form.BootFile, form.Params, |
|
|
storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"), jobType, gpuQueue, form.Description, branchName, form.BootFile, form.Params, |
|
|
0, 0, resourceSpecId) |
|
|
|
|
|
|
|
|
0, benchmarkChildTypeID, resourceSpecId) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cloudBrainNewDataPrepare(ctx) |
|
|
cloudBrainNewDataPrepare(ctx) |
|
|
ctx.RenderWithErr(err.Error(), tpl, &form) |
|
|
ctx.RenderWithErr(err.Error(), tpl, &form) |
|
|
@@ -2088,6 +2092,17 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) |
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") |
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getBrainRegion(benchmarkChildTypeID int) string { |
|
|
|
|
|
values := []string{"V1", "V2", "V4", "IT"} |
|
|
|
|
|
return values[benchmarkChildTypeID] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func trimSpaceNewlineInString(s string) string { |
|
|
|
|
|
re := regexp.MustCompile(`\r?\n`) |
|
|
|
|
|
return re.ReplaceAllString(s, " ") |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func BenchmarkDel(ctx *context.Context) { |
|
|
func BenchmarkDel(ctx *context.Context) { |
|
|
if err := deleteCloudbrainJob(ctx); err != nil { |
|
|
if err := deleteCloudbrainJob(ctx); err != nil { |
|
|
log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"]) |
|
|
log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"]) |
|
|
|