Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1572 Reviewed-by: lewis <747342561@qq.com>pull/1588/head
@@ -59,10 +59,11 @@ | |||||
package v1 | package v1 | ||||
import ( | import ( | ||||
"code.gitea.io/gitea/routers/authentication" | |||||
"net/http" | "net/http" | ||||
"strings" | "strings" | ||||
"code.gitea.io/gitea/routers/authentication" | |||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
"code.gitea.io/gitea/modules/auth" | "code.gitea.io/gitea/modules/auth" | ||||
"code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
@@ -880,9 +881,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
}, reqAnyRepoReader()) | }, reqAnyRepoReader()) | ||||
m.Group("/cloudbrain", func() { | m.Group("/cloudbrain", func() { | ||||
m.Get("/:jobid", repo.GetCloudbrainTask) | m.Get("/:jobid", repo.GetCloudbrainTask) | ||||
m.Get("/:jobid/log", repo.CloudbrainGetLog) | |||||
// m.Get("/:jobname", repo.GetCloudbrainTask) | |||||
// m.Get("/:jobname/log", repo.CloudbrainGetLog) | |||||
m.Get("/:jobname/log", repo.CloudbrainGetLog) | |||||
}, reqRepoReader(models.UnitTypeCloudBrain)) | }, reqRepoReader(models.UnitTypeCloudBrain)) | ||||
m.Group("/modelarts", func() { | m.Group("/modelarts", func() { | ||||
m.Group("/notebook", func() { | m.Group("/notebook", func() { | ||||
@@ -97,13 +97,10 @@ func GetCloudbrainTask(ctx *context.APIContext) { | |||||
} | } | ||||
func CloudbrainGetLog(ctx *context.Context) { | func CloudbrainGetLog(ctx *context.Context) { | ||||
// jobName := ctx.Params(":jobname") | |||||
// job, err := models.GetCloudbrainByName(jobName) | |||||
jobID := ctx.Params(":jobid") | |||||
repoID := ctx.Repo.Repository.ID | |||||
job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) | |||||
jobName := ctx.Params(":jobname") | |||||
job, err := models.GetCloudbrainByName(jobName) | |||||
if err != nil { | if err != nil { | ||||
log.Error("GetCloudbrainByJobID failed: %v", err, ctx.Data["MsgID"]) | |||||
log.Error("GetCloudbrainByJobName failed: %v", err, ctx.Data["MsgID"]) | |||||
ctx.ServerError(err.Error(), err) | ctx.ServerError(err.Error(), err) | ||||
return | return | ||||
} | } | ||||
@@ -148,7 +145,7 @@ func CloudbrainGetLog(ctx *context.Context) { | |||||
} | } | ||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"JobID": jobID, | |||||
"JobName": jobName, | |||||
"Content": content, | "Content": content, | ||||
}) | }) | ||||