From 532d3c5c35e92d80c26c2b8e0786595fc89cca04 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Wed, 30 Dec 2020 10:58:52 +0800
Subject: [PATCH 01/13] benchmark
---
modules/cloudbrain/cloudbrain.go | 10 +++++++++-
modules/setting/setting.go | 2 ++
routers/repo/cloudbrain.go | 27 +++++++++++++++++++++++++--
templates/repo/cloudbrain/new.tmpl | 4 ++++
4 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/modules/cloudbrain/cloudbrain.go b/modules/cloudbrain/cloudbrain.go
index 52057f0b8..394b29432 100755
--- a/modules/cloudbrain/cloudbrain.go
+++ b/modules/cloudbrain/cloudbrain.go
@@ -14,13 +14,14 @@ const (
CodeMountPath = "/code"
DataSetMountPath = "/dataset"
ModelMountPath = "/model"
+ BenchMarkMountPath = "/benchmark"
SubTaskName = "task1"
Success = "S000"
)
-func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath string) error {
+func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath string) error {
dataActualPath := setting.Attachment.Minio.RealPath +
setting.Attachment.Minio.Bucket + "/" +
setting.Attachment.Minio.BasePath +
@@ -69,6 +70,13 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath,
ReadOnly: false,
},
},
+ {
+ HostPath: models.StHostPath{
+ Path: benchmarkPath,
+ MountPath: BenchMarkMountPath,
+ ReadOnly: true,
+ },
+ },
},
})
if err != nil {
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 3fa6403a1..cea5b2316 100755
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -438,6 +438,7 @@ var (
JobPath string
JobType string
DebugServerHost string
+ BenchmarkCode string
)
// DateLang transforms standard language locale name to corresponding value in datetime plugin.
@@ -1113,6 +1114,7 @@ func NewContext() {
JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/")
DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73")
JobType = sec.Key("JOB_TYPE").MustString("debug_openi")
+ BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git")
}
func loadInternalToken(sec *ini.Section) string {
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 389f86b24..d51d6d7d7 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -4,6 +4,7 @@ import (
"code.gitea.io/gitea/modules/git"
"errors"
"os"
+ "os/exec"
"strconv"
"strings"
"time"
@@ -109,6 +110,7 @@ func CloudBrainNew(ctx *context.Context) {
ctx.Data["code_path"] = cloudbrain.CodeMountPath
ctx.Data["dataset_path"] = cloudbrain.DataSetMountPath
ctx.Data["model_path"] = cloudbrain.ModelMountPath
+ ctx.Data["benchmark_path"] = cloudbrain.BenchMarkMountPath
ctx.HTML(200, tplCloudBrainNew)
}
@@ -122,14 +124,17 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
repo := ctx.Repo.Repository
downloadCode(repo, codePath)
- modelPath := setting.JobPath + jobName + "/model"
+ modelPath := setting.JobPath + jobName + cloudbrain.ModelMountPath
err := os.MkdirAll(modelPath, os.ModePerm)
if err != nil {
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form)
return
}
- err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath)
+ benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
+ downloadBenchmarkCode(benchmarkPath)
+
+ err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath)
if err != nil {
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form)
return
@@ -255,3 +260,21 @@ func downloadCode(repo *models.Repository, codePath string) error {
return nil
}
+
+func downloadBenchmarkCode(benchmarkPath string) error {
+ err := os.MkdirAll(benchmarkPath, os.ModePerm)
+ if err != nil {
+ log.Error("mkdir benchmarkPath failed", err.Error())
+ return err
+ }
+
+ command := "git clone " + setting.BenchmarkCode + " " + benchmarkPath
+ cmd := exec.Command("/bin/bash", "-c", command)
+ output, err := cmd.Output()
+ log.Info(string(output))
+ if err != nil {
+ log.Error("exec.Command(%s) failed:%v", command, err)
+ return err
+ }
+ return nil
+}
diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl
index 7714bae3d..a94bf1fe2 100755
--- a/templates/repo/cloudbrain/new.tmpl
+++ b/templates/repo/cloudbrain/new.tmpl
@@ -148,6 +148,10 @@
+
From 28cda399ddd7c4cb9d70f264c7d8dd24a688d1d2 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Thu, 31 Dec 2020 09:52:47 +0800
Subject: [PATCH 02/13] todo
---
routers/repo/cloudbrain.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index d51d6d7d7..1c8ce8035 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -276,5 +276,7 @@ func downloadBenchmarkCode(benchmarkPath string) error {
log.Error("exec.Command(%s) failed:%v", command, err)
return err
}
+
+ //todo: write sth into a config file
return nil
}
From 57194649cff02c820cc76e1f5515c7184ec365b4 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Mon, 4 Jan 2021 17:14:41 +0800
Subject: [PATCH 03/13] taskInfo
---
models/cloudbrain.go | 7 +++++++
modules/cloudbrain/cloudbrain.go | 1 +
routers/repo/cloudbrain.go | 31 ++++++++++++++++++++++++++++---
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/models/cloudbrain.go b/models/cloudbrain.go
index 8cf2132f9..1124e3470 100755
--- a/models/cloudbrain.go
+++ b/models/cloudbrain.go
@@ -130,6 +130,13 @@ type TaskPod struct {
} `json:"taskStatuses"`
}
+
+type TaskInfo struct {
+ Username string `json:"username"`
+ TaskName string `json:"task_name"`
+ CodeName string `json:"code_name"`
+}
+
func ConvertToTaskPod(input map[string]interface{}) (TaskPod, error) {
data, _ := json.Marshal(input)
var taskPod TaskPod
diff --git a/modules/cloudbrain/cloudbrain.go b/modules/cloudbrain/cloudbrain.go
index 394b29432..264efd6b4 100755
--- a/modules/cloudbrain/cloudbrain.go
+++ b/modules/cloudbrain/cloudbrain.go
@@ -15,6 +15,7 @@ const (
DataSetMountPath = "/dataset"
ModelMountPath = "/model"
BenchMarkMountPath = "/benchmark"
+ TaskInfoName = "/taskInfo"
SubTaskName = "task1"
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 1c8ce8035..14160ec94 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -2,6 +2,7 @@ package repo
import (
"code.gitea.io/gitea/modules/git"
+ "encoding/json"
"errors"
"os"
"os/exec"
@@ -132,7 +133,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
}
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
- downloadBenchmarkCode(benchmarkPath)
+ downloadBenchmarkCode(repo, jobName, benchmarkPath)
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath)
if err != nil {
@@ -261,7 +262,7 @@ func downloadCode(repo *models.Repository, codePath string) error {
return nil
}
-func downloadBenchmarkCode(benchmarkPath string) error {
+func downloadBenchmarkCode(repo *models.Repository, taskName string, benchmarkPath string) error {
err := os.MkdirAll(benchmarkPath, os.ModePerm)
if err != nil {
log.Error("mkdir benchmarkPath failed", err.Error())
@@ -277,6 +278,30 @@ func downloadBenchmarkCode(benchmarkPath string) error {
return err
}
- //todo: write sth into a config file
+ fileName := benchmarkPath + cloudbrain.TaskInfoName
+ f, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm)
+ if err != nil {
+ log.Error("OpenFile failed", err.Error())
+ return err
+ }
+
+ defer f.Close()
+
+ data, err := json.Marshal(models.TaskInfo{
+ Username: repo.Owner.Name,
+ TaskName: taskName,
+ CodeName: repo.Name,
+ })
+ if err != nil {
+ log.Error("json.Marshal failed", err.Error())
+ return err
+ }
+
+ _, err = f.Write(data)
+ if err != nil {
+ log.Error("WriteString failed", err.Error())
+ return err
+ }
+
return nil
}
From 2029a5a5bacde56d9438906232ff72f4e5955e62 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Wed, 6 Jan 2021 10:25:54 +0800
Subject: [PATCH 04/13] mod attachment
---
models/attachment.go | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/models/attachment.go b/models/attachment.go
index 3ba4112dc..063230e57 100755
--- a/models/attachment.go
+++ b/models/attachment.go
@@ -384,6 +384,7 @@ func getPrivateAttachments(e Engine, userID int64) ([]*AttachmentUsername, error
return attachments, nil
}
+/*
func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) {
attachsPub, err := getAllPublicAttachments(x)
if err != nil {
@@ -400,3 +401,17 @@ func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) {
return append(attachsPub, attachsPri...), nil
}
+ */
+
+func getAllUserAttachments(e Engine, userID int64) ([]*AttachmentUsername, error) {
+ attachments := make([]*AttachmentUsername, 0, 10)
+ if err := e.Table("attachment").Join("LEFT", "`user`", "attachment.uploader_id " +
+ "= `user`.id").Where("decompress_state= ? and (uploader_id= ? or is_private = ?)", DecompressStateDone, userID, false).Find(&attachments); err != nil {
+ return nil, err
+ }
+ return attachments, nil
+}
+
+func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) {
+ return getAllUserAttachments(x, userID)
+}
From 729dfa8f16be015e34162e5131a13512f06ddbee Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Wed, 6 Jan 2021 17:59:44 +0800
Subject: [PATCH 05/13] benchmark config
---
modules/setting/setting.go | 6 ++++++
routers/repo/cloudbrain.go | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index cea5b2316..c38764088 100755
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -438,6 +438,9 @@ var (
JobPath string
JobType string
DebugServerHost string
+
+ //benchmark config
+ IsBenchmarkEnabled bool
BenchmarkCode string
)
@@ -1114,6 +1117,9 @@ func NewContext() {
JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/")
DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73")
JobType = sec.Key("JOB_TYPE").MustString("debug_openi")
+
+ sec = Cfg.Section("benchmark")
+ IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false)
BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git")
}
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 0d7937c5d..ed53e86d0 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -112,6 +112,7 @@ func CloudBrainNew(ctx *context.Context) {
ctx.Data["dataset_path"] = cloudbrain.DataSetMountPath
ctx.Data["model_path"] = cloudbrain.ModelMountPath
ctx.Data["benchmark_path"] = cloudbrain.BenchMarkMountPath
+ ctx.Data["is_benchmark_enabled"] = setting.IsBenchmarkEnabled
ctx.HTML(200, tplCloudBrainNew)
}
@@ -133,7 +134,9 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
}
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
- downloadBenchmarkCode(repo, jobName, benchmarkPath)
+ if setting.IsBenchmarkEnabled {
+ downloadBenchmarkCode(repo, jobName, benchmarkPath)
+ }
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath)
if err != nil {
From aadc6e91abb2226684fd8f3bbd0ff5f91f1988e8 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Thu, 7 Jan 2021 11:15:34 +0800
Subject: [PATCH 06/13] add benchmark enabled
---
models/cloudbrain.go | 5 +++++
modules/auth/cloudbrain.go | 1 +
modules/cloudbrain/cloudbrain.go | 3 ++-
routers/repo/cloudbrain.go | 5 +++--
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/models/cloudbrain.go b/models/cloudbrain.go
index da6baa169..c6d4e30c9 100755
--- a/models/cloudbrain.go
+++ b/models/cloudbrain.go
@@ -13,6 +13,7 @@ import (
)
type CloudbrainStatus string
+type JobType string
const (
JobWaiting CloudbrainStatus = "WAITING"
@@ -20,11 +21,15 @@ const (
JobSucceeded CloudbrainStatus = "SUCCEEDED"
JobFailed CloudbrainStatus = "FAILED"
JobRunning CloudbrainStatus = "RUNNING"
+
+ JobTypeDebug JobType = "DEBUG"
+ JobTypeBenchmark JobType = "BENCHMARK"
)
type Cloudbrain struct {
ID int64 `xorm:"pk autoincr"`
JobID string `xorm:"INDEX NOT NULL"`
+ JobType string `xorm:"INDEX NOT NULL"`
JobName string `xorm:"INDEX"`
Status string `xorm:"INDEX"`
UserID int64 `xorm:"INDEX"`
diff --git a/modules/auth/cloudbrain.go b/modules/auth/cloudbrain.go
index b7b59ce63..ce2733afb 100755
--- a/modules/auth/cloudbrain.go
+++ b/modules/auth/cloudbrain.go
@@ -11,6 +11,7 @@ type CreateCloudBrainForm struct {
Image string `form:"image" binding:"Required"`
Command string `form:"command" binding:"Required"`
Attachment string `form:"attachment" binding:"Required"`
+ JobType string `form:"job_type" binding:"Required"`
}
type CommitImageCloudBrainForm struct {
diff --git a/modules/cloudbrain/cloudbrain.go b/modules/cloudbrain/cloudbrain.go
index 264efd6b4..dccbee5c6 100755
--- a/modules/cloudbrain/cloudbrain.go
+++ b/modules/cloudbrain/cloudbrain.go
@@ -22,7 +22,7 @@ const (
Success = "S000"
)
-func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath string) error {
+func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, jobType string) error {
dataActualPath := setting.Attachment.Minio.RealPath +
setting.Attachment.Minio.Bucket + "/" +
setting.Attachment.Minio.BasePath +
@@ -97,6 +97,7 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath,
JobID: jobID,
JobName: jobName,
SubTaskName: SubTaskName,
+ JobType: jobType,
})
if err != nil {
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index ed53e86d0..8b1e3c384 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -122,6 +122,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
image := form.Image
command := form.Command
uuid := form.Attachment
+ jobType := form.JobType
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath
repo := ctx.Repo.Repository
downloadCode(repo, codePath)
@@ -134,11 +135,11 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
}
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
- if setting.IsBenchmarkEnabled {
+ if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) {
downloadBenchmarkCode(repo, jobName, benchmarkPath)
}
- err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath)
+ err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, jobType)
if err != nil {
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form)
return
From ddca8d0924232bdbe1079eb7a69ed7e0dfb57077 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Thu, 7 Jan 2021 11:21:32 +0800
Subject: [PATCH 07/13] add default
---
models/cloudbrain.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/cloudbrain.go b/models/cloudbrain.go
index c6d4e30c9..7244bc3ab 100755
--- a/models/cloudbrain.go
+++ b/models/cloudbrain.go
@@ -29,7 +29,7 @@ const (
type Cloudbrain struct {
ID int64 `xorm:"pk autoincr"`
JobID string `xorm:"INDEX NOT NULL"`
- JobType string `xorm:"INDEX NOT NULL"`
+ JobType string `xorm:"INDEX NOT NULL DEFAULT 'DEBUG'"`
JobName string `xorm:"INDEX"`
Status string `xorm:"INDEX"`
UserID int64 `xorm:"INDEX"`
From e38f3968ae6753931c4c45099e2e1f85de613265 Mon Sep 17 00:00:00 2001
From: Gitea
Date: Thu, 7 Jan 2021 15:05:23 +0800
Subject: [PATCH 08/13] add judge whether to display or not.
---
templates/repo/cloudbrain/new.tmpl | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl
index dff4ca646..8b8f23c4c 100755
--- a/templates/repo/cloudbrain/new.tmpl
+++ b/templates/repo/cloudbrain/new.tmpl
@@ -102,12 +102,17 @@
{{.i18n.Tr "repo.cloudbrain.new"}}
-
+
-
+
+
+
+
+
+
-
+
From 8227acce716e27f3ae4207180f1d1f3e51367c22 Mon Sep 17 00:00:00 2001
From: Gitea
Date: Thu, 7 Jan 2021 17:11:10 +0800
Subject: [PATCH 09/13] add judge.
---
templates/repo/cloudbrain/new.tmpl | 42 +++++++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl
index 8b8f23c4c..409ae01bb 100755
--- a/templates/repo/cloudbrain/new.tmpl
+++ b/templates/repo/cloudbrain/new.tmpl
@@ -80,6 +80,10 @@
-webkit-transform: scaleY(1.0);
}
}
+
+ .inline.required.field.cloudbrain_benchmark {
+ display: none;
+ }
@@ -110,25 +114,30 @@
-
+
+ {{range .images}}
+
+ {{end}}
+
+
+ {{range .attachments}}
+
+ {{end}}
+
+
@@ -141,7 +150,7 @@
-
+
@@ -175,4 +184,17 @@
document.getElementById("mask").style.display = "none"
}
}
+
+ $('select.dropdown')
+ .dropdown();
+
+ $(function() {
+ $("#cloudbrain_job_type").change(function() {
+ if ($(this).val() == 'BENCHMARK') {
+ $(".cloudbrain_benchmark").show();
+ } else {
+ $(".cloudbrain_benchmark").hide();
+ }
+ })
+ })
\ No newline at end of file
From cb526ff563655fa04a423ed3ed45eeca2805dfe6 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Thu, 7 Jan 2021 17:27:13 +0800
Subject: [PATCH 10/13] add benchmark host
---
modules/setting/setting.go | 2 ++
routers/repo/cloudbrain.go | 11 +++++++++++
routers/routes/routes.go | 1 +
3 files changed, 14 insertions(+)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index c38764088..a71617e8d 100755
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -442,6 +442,7 @@ var (
//benchmark config
IsBenchmarkEnabled bool
BenchmarkCode string
+ BenchmarkServerHost string
)
// DateLang transforms standard language locale name to corresponding value in datetime plugin.
@@ -1121,6 +1122,7 @@ func NewContext() {
sec = Cfg.Section("benchmark")
IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false)
BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git")
+ BenchmarkServerHost = sec.Key("HOST").MustString("http://192.168.202.90:3366/")
}
func loadInternalToken(sec *ini.Section) string {
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 8b1e3c384..98c6457e4 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -280,6 +280,17 @@ func CloudBrainDel(ctx *context.Context) {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain")
}
+func CloudBrainBenchmark(ctx *context.Context) {
+ var jobID = ctx.Params(":jobid")
+ _, err := models.GetCloudbrainByJobID(jobID)
+ if err != nil {
+ ctx.ServerError("GetCloudbrainByJobID failed", err)
+ return
+ }
+
+ ctx.Redirect(setting.BenchmarkServerHost)
+}
+
func downloadCode(repo *models.Repository, codePath string) error {
if err := git.Clone(repo.RepoPath(), codePath, git.CloneRepoOptions{}); err != nil {
log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err)
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index c7f969e76..790650a2d 100755
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -900,6 +900,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/commit_image", reqRepoCloudBrainWriter, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage)
m.Post("/stop", reqRepoCloudBrainWriter, repo.CloudBrainStop)
m.Post("/del", reqRepoCloudBrainWriter, repo.CloudBrainDel)
+ m.Post("/benchmark", reqRepoCloudBrainWriter, repo.CloudBrainBenchmark)
})
m.Get("/create", reqRepoCloudBrainWriter, repo.CloudBrainNew)
m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate)
From 816d0a3c7fb16c3299129ae8291f1938084ac88d Mon Sep 17 00:00:00 2001
From: Gitea
Date: Thu, 7 Jan 2021 19:46:08 +0800
Subject: [PATCH 11/13] add acore and new window, a bug in href.
---
templates/repo/cloudbrain/index.tmpl | 47 +++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl
index 18c5053e2..40e4adafb 100755
--- a/templates/repo/cloudbrain/index.tmpl
+++ b/templates/repo/cloudbrain/index.tmpl
@@ -221,8 +221,8 @@
- {{.i18n.Tr "repo.issues.filter_sort"}}
-
+ {{.i18n.Tr "repo.issues.filter_sort"}}
+
@@ -235,7 +235,7 @@
-
+
From e3c136e597668d7bba4c57270a9456b0dfcf1126 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Fri, 8 Jan 2021 09:06:51 +0800
Subject: [PATCH 12/13] mod router
---
routers/routes/routes.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 790650a2d..f40b55e2b 100755
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -900,7 +900,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/commit_image", reqRepoCloudBrainWriter, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage)
m.Post("/stop", reqRepoCloudBrainWriter, repo.CloudBrainStop)
m.Post("/del", reqRepoCloudBrainWriter, repo.CloudBrainDel)
- m.Post("/benchmark", reqRepoCloudBrainWriter, repo.CloudBrainBenchmark)
+ m.Get("/benchmark", reqRepoCloudBrainWriter, repo.CloudBrainBenchmark)
})
m.Get("/create", reqRepoCloudBrainWriter, repo.CloudBrainNew)
m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate)
From 85313b4607db089d320f0e9fd10ce2bbc8dae827 Mon Sep 17 00:00:00 2001
From: Gitea
Date: Fri, 8 Jan 2021 10:05:49 +0800
Subject: [PATCH 13/13] stop new window when icon is gray.
---
templates/repo/cloudbrain/index.tmpl | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl
index 40e4adafb..2a9320f27 100755
--- a/templates/repo/cloudbrain/index.tmpl
+++ b/templates/repo/cloudbrain/index.tmpl
@@ -169,6 +169,11 @@
.dis {
margin-bottom: 20px;
}
+
+ .disabled {
+ cursor: pointer;
+ pointer-events: none;
+ }
@@ -261,9 +266,10 @@
+
-
+
评分
@@ -282,7 +288,7 @@
-
+
调试
@@ -380,6 +386,15 @@
{{template "base/footer" .}}