From b6e31fcd9cd8b830a1c1d286582a758330412e51 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 14:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/modelarts.go | 15 ++++++++++++++- templates/repo/modelarts/notebook/show.tmpl | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 1f4a275d1..3f835ee5d 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -281,6 +281,7 @@ func NotebookShow(ctx *context.Context) { if task.Uuid != "" && task.UserID == ctx.User.ID { attachment, err := models.GetAttachmentByUUID(task.Uuid) if err == nil { + task.DatasetName = attachment.Name datasetDownloadLink = attachment.S3DownloadURL() } } @@ -301,7 +302,19 @@ func NotebookShow(ctx *context.Context) { } } } - + if task.TrainJobDuration == "" { + if task.Duration == 0 { + var duration int64 + if task.Status == string(models.JobRunning) { + duration = time.Now().Unix() - int64(task.CreatedUnix) + } else { + duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) + } + task.Duration = duration + } + task.TrainJobDuration = models.ConvertDurationToStr(task.Duration) + } + ctx.Data["duration"] = task.TrainJobDuration ctx.Data["datasetDownloadLink"] = datasetDownloadLink ctx.Data["task"] = task ctx.Data["ID"] = ID diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 35180cedd..f8122bead 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -328,7 +328,7 @@ td, th {
- {{.DatasetName}} + {{.DatasetName}}
@@ -360,12 +360,12 @@ td, th { - 描述 + {{$.i18n.Tr "cloudbrain.description"}}
- -- + {{.Description}}