Browse Source

增加详情页面路由

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 3 years ago
parent
commit
2b06c69788
2 changed files with 8 additions and 1 deletions
  1. +7
    -1
      routers/repo/aisafety.go
  2. +1
    -0
      routers/routes/routes.go

+ 7
- 1
routers/repo/aisafety.go View File

@@ -31,6 +31,7 @@ import (
const (
tplModelSafetyTestCreateGpu = "repo/modelsafety/newgpu"
tplModelSafetyTestCreateNpu = "repo/modelsafety/newnpu"
tplModelSafetyTestShow = "repo/modelsafety/show"
)

func CloudBrainAiSafetyCreateTest(ctx *context.Context) {
@@ -67,13 +68,16 @@ func CloudBrainAiSafetyCreateTest(ctx *context.Context) {
}

func GetAiSafetyTaskByJob(job *models.Cloudbrain) {

if job == nil {
log.Error("GetCloudbrainByJobID failed")
return
}
syncAiSafetyTaskStatus(job)
}

func GetAiSafetyTaskTmpl(ctx *context.Context) {
ctx.Data["id"] = ctx.Params(":jobid")
ctx.HTML(200, tplModelSafetyTestShow)
}

func GetAiSafetyTask(ctx *context.Context) {
@@ -85,6 +89,8 @@ func GetAiSafetyTask(ctx *context.Context) {
}
syncAiSafetyTaskStatus(job)
job, err = models.GetCloudbrainByJobIDWithDeleted(ID)
job.BenchmarkType = "CV"
job.BenchmarkTypeName = "Classification"
ctx.JSON(200, job)
}



+ 1
- 0
routers/routes/routes.go View File

@@ -1229,6 +1229,7 @@ func RegisterRoutes(m *macaron.Macaron) {

m.Group("/modelsafety", func() {
m.Group("/:jobid", func() {
m.Get("/show", reqRepoCloudBrainWriter, repo.GetAiSafetyTaskTmpl)
m.Get("", reqRepoCloudBrainWriter, repo.GetAiSafetyTask)
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.StopAiSafetyTask)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.DelAiSafetyTask)


Loading…
Cancel
Save