Browse Source

提交代码,更改任务状态。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/3035/head
zouap 2 years ago
parent
commit
bab8d2809e
3 changed files with 15 additions and 6 deletions
  1. +4
    -0
      routers/api/v1/api.go
  2. +10
    -6
      routers/api/v1/repo/cloudbrain.go
  3. +1
    -0
      routers/repo/aisafety.go

+ 4
- 0
routers/api/v1/api.go View File

@@ -951,6 +951,10 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/:id/modelartlog", repo.TrainJobForModelConvertGetLog)
m.Get("/:id/model_list", repo.CloudBrainModelConvertList)
}, reqRepoReader(models.UnitTypeModelManage))
m.Group("/modelsafety", func() {
m.Get("/:id/log", repo.ModelSafetyGetLog)
m.Get("/:id/down_log_file", repo.ModelSafetyDownloadLogFile)
}, reqRepoReader(models.UnitTypeModelManage))
m.Group("/modelarts", func() {
m.Group("/notebook", func() {
//m.Get("/:jobid", repo.GetModelArtsNotebook)


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

@@ -383,7 +383,7 @@ func CloudbrainForModelConvertGetLog(ctx *context.Context) {
ctx.JSON(http.StatusOK, result)
}

func CloudbrainForModelSafetyGetLog(ctx *context.Context) {
func ModelSafetyGetLog(ctx *context.APIContext) {
ID := ctx.Params(":id")
job, err := models.GetCloudbrainByID(ID)
if err != nil {
@@ -393,13 +393,17 @@ func CloudbrainForModelSafetyGetLog(ctx *context.Context) {
}
if job.JobType == string(models.JobTypeModelSafety) {
if job.Type == models.TypeCloudBrainOne {
CloudbrainGetLog(ctx)
} else if job.Type == models.TypeCloudBrainTwo {
TrainJobForModelConvertGetLog(ctx)
}
}
result := ""
ctx.JSON(http.StatusOK, result)
//result := ""
//ctx.JSON(http.StatusOK, result)
}

func ModelSafetyDownloadLogFile(ctx *context.Context) {

}

func CloudbrainDownloadLogFile(ctx *context.Context) {
@@ -443,7 +447,7 @@ func CloudbrainDownloadLogFile(ctx *context.Context) {
}
}

func CloudbrainGetLog(ctx *context.Context) {
func CloudbrainGetLog(ctx *context.APIContext) {
ID := ctx.Params(":id")
job, err := models.GetCloudbrainByID(ID)
if err != nil {


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

@@ -443,6 +443,7 @@ func queryTaskStatusFromModelSafetyTestServer(job *models.Cloudbrain) {
} else {
if result.Data.Code == 0 {
job.ResultJson = result.Data.StandardJson
job.Status = string(models.JobSucceeded)
err = models.UpdateJob(job)
if err != nil {
log.Error("UpdateJob failed:", err)


Loading…
Cancel
Save