Browse Source

fix bug

tags/v1.22.2.2^2
liuzx 3 years ago
parent
commit
939e27afa9
3 changed files with 8 additions and 8 deletions
  1. +1
    -1
      routers/api/v1/api.go
  2. +4
    -4
      routers/api/v1/repo/cloudbrain.go
  3. +3
    -3
      templates/repo/cloudbrain/benchmark/show.tmpl

+ 1
- 1
routers/api/v1/api.go View File

@@ -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() {


+ 4
- 4
routers/api/v1/repo/cloudbrain.go View File

@@ -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,
})



+ 3
- 3
templates/repo/cloudbrain/benchmark/show.tmpl View File

@@ -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)


Loading…
Cancel
Save