diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index c6c5703b3..36f220cef 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -880,7 +880,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/cloudbrain", func() { // m.Get("/:jobid", repo.GetCloudbrainTask) m.Get("/:jobname", repo.GetCloudbrainTask) - m.Get("/:jobid/log", repo.CloudbrainGetLog) + m.Get("/:jobname/log", repo.CloudbrainGetLog) }, reqRepoReader(models.UnitTypeCloudBrain)) m.Group("/modelarts", func() { m.Group("/notebook", func() { diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 35044a894..6a2538048 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -93,8 +93,8 @@ func GetCloudbrainTask(ctx *context.APIContext) { } func CloudbrainGetLog(ctx *context.Context) { - jobID := ctx.Params(":jobid") - _, err := models.GetCloudbrainByJobID(jobID) + jobName := ctx.Params(":jobname") + job, err := models.GetCloudbrainByName(jobName) if err != nil { log.Error("GetCloudbrainByJobID failed: %v", err, ctx.Data["MsgID"]) ctx.ServerError(err.Error(), err) @@ -102,7 +102,7 @@ func CloudbrainGetLog(ctx *context.Context) { } var hits []models.Hits - result, err := cloudbrain.GetJobLog(jobID) + result, err := cloudbrain.GetJobLog(job.JobID) if err != nil { log.Error("GetJobLog failed: %v", err, ctx.Data["MsgID"]) ctx.ServerError(err.Error(), err) @@ -141,7 +141,7 @@ func CloudbrainGetLog(ctx *context.Context) { } ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobID": jobID, + "JobName": jobName, "Content": content, }) diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl index 99fd35de2..10453b446 100755 --- a/templates/repo/cloudbrain/benchmark/show.tmpl +++ b/templates/repo/cloudbrain/benchmark/show.tmpl @@ -432,19 +432,19 @@ td, th { let userName let repoPath - let jobID + let jobName $(document).ready(function(){ let url = window.location.href; let urlArr = url.split('/') userName = urlArr.slice(-5)[0] repoPath = urlArr.slice(-4)[0] - jobID = urlArr.slice(-1)[0] + jobName = urlArr.slice(-1)[0] }) function loadLog(version_name){ document.getElementById("mask").style.display = "block" - $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { + $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { $('input[name=end_line]').val(data.EndLine) $('input[name=start_line]').val(data.StartLine) $(`#log_file${version_name}`).text(data.Content)