From 3daf44428f13cb1c8763b7ee3c44635cd0556884 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 24 Mar 2022 10:11:54 +0800 Subject: [PATCH] stop version --- routers/api/v1/api.go | 7 +++++-- routers/repo/cloudbrain.go | 3 ++- routers/routes/routes.go | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index b0ff7e9b8..1868edcb5 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -62,10 +62,10 @@ import ( "net/http" "strings" - "code.gitea.io/gitea/routers/authentication" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" + + "code.gitea.io/gitea/modules/cloudbrain" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -77,6 +77,7 @@ import ( "code.gitea.io/gitea/routers/api/v1/repo" _ "code.gitea.io/gitea/routers/api/v1/swagger" // for swagger generation "code.gitea.io/gitea/routers/api/v1/user" + "code.gitea.io/gitea/routers/authentication" repo_ext "code.gitea.io/gitea/routers/repo" "gitea.com/macaron/binding" @@ -884,7 +885,9 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/:id/log", repo.CloudbrainGetLog) m.Group("/train-job", func() { m.Group("/:jobid", func() { + m.Get("", repo.GetModelArtsTrainJobVersion) m.Get("/model_list", repo.CloudBrainModelList) + m.Post("/stop_version", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo_ext.CloudBrainStop) }) }) }, reqRepoReader(models.UnitTypeCloudBrain)) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 8d1f071eb..eab9df09c 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -544,11 +544,12 @@ func CloudBrainStop(ctx *context.Context) { break } - ctx.JSON(200, map[string]string{ + ctx.JSON(200, map[string]interface{}{ "result_code": resultCode, "error_msg": errorMsg, "status": status, "id": ID, + "StatusOK": 0, }) } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 88243291b..eae7f159a 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1020,7 +1020,6 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/train-job", func() { m.Group("/:jobid", func() { m.Get("", reqRepoCloudBrainReader, repo.CloudBrainTrainJobShow) - m.Post("/stop_version", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainStop) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainTrainJobDel) //m.Get("/models", reqRepoCloudBrainReader, repo.CloudBrainShowModels) m.Get("/download_model", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainDownloadModel)