Browse Source

提交代码

pull/2062/head
ychao_1983 3 years ago
parent
commit
1ae005fa35
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      routers/repo/cloudbrain.go

+ 8
- 2
routers/repo/cloudbrain.go View File

@@ -2066,7 +2066,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "")
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, form.Description)
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description))

}
benchmarkChildTypeID := 0
@@ -2075,7 +2075,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "")
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
benchmarkChildTypeID = form.BenchmarkChildTypeID
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, form.Description)
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+"/"),
@@ -2097,6 +2097,12 @@ func getBrainRegion(benchmarkChildTypeID int) string {
return values[benchmarkChildTypeID]
}

func trimSpaceNewlineInString(s string) string {
re := regexp.MustCompile(`\r?\n`)
return re.ReplaceAllString(s, " ")

}

func BenchmarkDel(ctx *context.Context) {
if err := deleteCloudbrainJob(ctx); err != nil {
log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"])


Loading…
Cancel
Save