From bab8d2809e5418c33e4e4ce202057601ea66f08c Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Oct 2022 14:23:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/api/v1/api.go | 4 ++++ routers/api/v1/repo/cloudbrain.go | 16 ++++++++++------ routers/repo/aisafety.go | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 6dd1cb32f..ce0be2a90 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 7f58576ed..8456014db 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -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 { diff --git a/routers/repo/aisafety.go b/routers/repo/aisafety.go index 4cba1ffbd..58baf1a0c 100644 --- a/routers/repo/aisafety.go +++ b/routers/repo/aisafety.go @@ -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)