From 5123cbd7ead78411839b21ee523535012ba265ce Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:42:23 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 1 + models/user_business_struct.go | 13 +- .../repo/modelarts/notebook/show--.tmpl-- | 68 +++ templates/repo/modelarts/notebook/show.tmpl | 501 ++++++++++++++++-- 4 files changed, 523 insertions(+), 60 deletions(-) create mode 100644 templates/repo/modelarts/notebook/show--.tmpl-- diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 65ce642d54..db226b14b4 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -720,6 +720,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, useMetrics.NotActivateRegistUser = getMapKeyStringValue("NotActivateRegistUser", userMetrics) useMetrics.TotalActivateRegistUser = getMapKeyStringValue("TotalActivateRegistUser", userMetrics) useMetrics.TotalHasActivityUser = getMapKeyStringValue("TotalHasActivityUser", userMetrics) + useMetrics.DataDate = currentTimeNow.Format("2006-01-02 15:04:05") statictisSess.Insert(&useMetrics) return nil diff --git a/models/user_business_struct.go b/models/user_business_struct.go index 17d9f046f6..1a7625d827 100644 --- a/models/user_business_struct.go +++ b/models/user_business_struct.go @@ -344,10 +344,11 @@ type UserAnalysisPara struct { } type UserMetrics struct { - CountDate int64 `xorm:"pk"` - ActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - NotActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - HasActivityUser int `xorm:"NOT NULL DEFAULT 0"` - TotalActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - TotalHasActivityUser int `xorm:"NOT NULL DEFAULT 0"` + CountDate int64 `xorm:"pk"` + ActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + NotActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + HasActivityUser int `xorm:"NOT NULL DEFAULT 0"` + TotalActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + TotalHasActivityUser int `xorm:"NOT NULL DEFAULT 0"` + DataDate string `xorm:"NULL"` } diff --git a/templates/repo/modelarts/notebook/show--.tmpl-- b/templates/repo/modelarts/notebook/show--.tmpl-- new file mode 100644 index 0000000000..59474ee496 --- /dev/null +++ b/templates/repo/modelarts/notebook/show--.tmpl-- @@ -0,0 +1,68 @@ +{{template "base/head" .}} +
+{{template "repo/header" .}} +
+
+ {{template "base/alert" .}} + +

+ +

+
+
+ {{with .task}} +

任务名称: {{.DisplayJobName}}

+ {{end}} +
+
+

任务详情:

+ {{with .result}} + + + + + + + + + + + + + + + + + + + + + + + + + + + +
状态 {{.Status}}
描述 {{$.task.Description}}
镜像名称 {{$.task.Image}}
数据集下载地址 {{$.datasetDownloadLink}}
开始时间 {{.CreateTime}}
最后更新时间 {{.LatestUpdateTime}}
+ {{end}} +
+ +
+ +
+
+
+{{template "base/footer" .}} diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 59474ee496..8e69dac3e1 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -1,68 +1,461 @@ {{template "base/head" .}} + +
+
+
+
+
+
+
+
+
{{template "repo/header" .}} -
-
- {{template "base/alert" .}} - +

+

-
-
- {{with .task}} -

任务名称: {{.DisplayJobName}}

- {{end}} -
-
-

任务详情:

- {{with .result}} - - - - - - - - - - - - - - - - - - - - - - - - - - - -
状态 {{.Status}}
描述 {{$.task.Description}}
镜像名称 {{$.task.Image}}
数据集下载地址 {{$.datasetDownloadLink}}
开始时间 {{.CreateTime}}
最后更新时间 {{.LatestUpdateTime}}
- {{end}} -
- + +
+
+
+
+ + + +
+ + {{if not (eq .StartTime 0)}} + {{TimeSinceUnix1 .StartTime}} + {{else}} + {{TimeSinceUnix1 .CreatedUnix}} + {{end}} + + + {{$.i18n.Tr "repo.modelarts.status"}}: + {{.Status}} + + {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}: + {{$.duration}} + +
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{$.i18n.Tr "repo.cloudbrain_task"}} + +
+ {{.DisplayJobName}} +
+
+ {{$.i18n.Tr "repo.modelarts.status"}} + +
+ {{.Status}} +
+
+ {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} + +
+ + {{if not (eq .StartTime 0)}} + {{TimeSinceUnix1 .StartTime}} + {{else}} + {{TimeSinceUnix1 .CreatedUnix}} + {{end}} + +
+
+ {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} + +
+ {{$.duration}} +
+
+ {{$.i18n.Tr "cloudbrain.mirror"}} + +
+ {{.Image}} +
+
+ {{$.i18n.Tr "cloudbrain.dataset_storage_path"}} + +
+ {{$.dataset_path}} +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{$.i18n.Tr "repo.cloudbrain.endtime"}} + +
+ {{if not (eq .StartTime 0)}} + {{TimeSinceUnix1 .EndTime}} + {{else}} + -- + {{end}} +
+
+ {{$.i18n.Tr "repo.modelarts.train_job.dataset"}} + +
+ {{$.datasetname}} +
+
+ {{$.i18n.Tr "repo.modelarts.train_job.standard"}} + +
+ {{$.resource_spec}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_creator"}} + +
+ {{.User.Name}} +
+
+ 描述 + +
+ -- +
+
+
+
+ +
+ +
+
+ + +
+
+ {{end}} {{template "base/paginate" .}} +
+ +
+
-
+ +
{{template "base/footer" .}} + + -- 2.34.1 From 6400513d3e0654b95c9ef79f099b8f17e4f525f9 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:46:19 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 8e69dac3e1..d9c38eb446 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -397,7 +397,7 @@ td, th {
- {{end}} {{template "base/paginate" .}} + {{template "base/paginate" .}}
-- 2.34.1 From 3af7725f62bac7350e81116241790b6b39554642 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:51:07 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 26 +++++++-------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index d9c38eb446..4b44465876 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -190,11 +190,11 @@ td, th {
/
{{with .task}} -
{{.DisplayJobName}}
- {{end}} +
{{.jobName}}
+ {{end}}
- + {{with .task}}
@@ -204,7 +204,7 @@ td, th {
- {{if not (eq .StartTime 0)}} + {{if not (eq .task.StartTime 0)}} {{TimeSinceUnix1 .StartTime}} {{else}} {{TimeSinceUnix1 .CreatedUnix}} @@ -241,7 +241,7 @@ td, th {
- {{.DisplayJobName}} + {{.jobName}}
@@ -327,7 +327,7 @@ td, th {
- {{if not (eq .StartTime 0)}} + {{if not (eq .task.StartTime 0)}} {{TimeSinceUnix1 .EndTime}} {{else}} -- @@ -397,6 +397,7 @@ td, th {
+ {{end}} {{template "base/paginate" .}}
@@ -445,17 +446,6 @@ td, th { jobName = urlArr.slice(-1)[0] }) - function loadLog(version_name){ - document.getElementById("mask").style.display = "block" - $.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) - document.getElementById("mask").style.display = "none" - }).fail(function(err) { - console.log(err); - document.getElementById("mask").style.display = "none" - }); - } + -- 2.34.1 From 9426ce1a533d14559f894f23685df864de865fa1 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:51:59 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 4b44465876..b8fda3f7a3 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -189,9 +189,9 @@ td, th { {{$.i18n.Tr "repo.modelarts.notebook"}}
/
- {{with .task}} -
{{.jobName}}
- {{end}} + +
{{.jobName}}
+
{{with .task}} -- 2.34.1 From 877f3535da463138e8fbad3e92358934feda936b Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:52:30 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index b8fda3f7a3..e53d94fcc4 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -204,7 +204,7 @@ td, th {
- {{if not (eq .task.StartTime 0)}} + {{if not (eq .StartTime 0)}} {{TimeSinceUnix1 .StartTime}} {{else}} {{TimeSinceUnix1 .CreatedUnix}} -- 2.34.1 From a08b745d040c82958827ef5a22426049502b7e31 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:53:10 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index e53d94fcc4..4c946fa4a2 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -241,7 +241,7 @@ td, th {
- {{.jobName}} + {{$.jobName}}
-- 2.34.1 From deef8665fc3a7b0e31735b7f4669e3e95bb0ca5f Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:54:27 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 4c946fa4a2..ecd17ec993 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -327,7 +327,7 @@ td, th {
- {{if not (eq .task.StartTime 0)}} + {{if not (eq .StartTime 0)}} {{TimeSinceUnix1 .EndTime}} {{else}} -- @@ -342,7 +342,7 @@ td, th {
- {{$.datasetname}} + {{.datasetname}}
@@ -356,7 +356,7 @@ td, th {
- {{$.resource_spec}} + {{.resource_spec}}
-- 2.34.1 From f0423473ac3efffb79b13e13202f675274ca8deb Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:55:19 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index ecd17ec993..867f6f5911 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -342,7 +342,7 @@ td, th {
- {{.datasetname}} + {{$.datasetDownloadLink}}
-- 2.34.1 From 836f91aba01c1e16fe0f95459213867c5dcb273c Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 10:57:27 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 867f6f5911..5cfb964b10 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -342,7 +342,7 @@ td, th {
- {{$.datasetDownloadLink}} + {{.DatasetName}}
-- 2.34.1 From f7862ac693cc9e0aef8cfa6b1008b7f594b935c6 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 11:05:40 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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 | 10 +++++++--- templates/repo/modelarts/notebook/show.tmpl | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 32d9db9ce3..f003407c23 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -2,8 +2,6 @@ package repo import ( "archive/zip" - "code.gitea.io/gitea/modules/notification" - "code.gitea.io/gitea/modules/timeutil" "encoding/json" "errors" "io" @@ -16,6 +14,9 @@ import ( "time" "unicode/utf8" + "code.gitea.io/gitea/modules/notification" + "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" @@ -283,7 +284,10 @@ func NotebookShow(ctx *context.Context) { } } } - + if modelarts.FlavorInfos == nil { + json.Unmarshal([]byte(setting.FlavorInfos), &modelarts.FlavorInfos) + } + ctx.Data["resource_spec"] = modelarts.FlavorInfos.FlavorInfo 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 5cfb964b10..68c94cdca2 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -356,7 +356,7 @@ td, th {
- {{.resource_spec}} + {{$.resource_spec}}
-- 2.34.1 From 7623fcdca9dbd38b4e938757a7121e583d62541c Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 11:08:14 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index f003407c23..4b7582d4b6 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -284,6 +284,10 @@ func NotebookShow(ctx *context.Context) { } } } + user, err := models.GetUserByID(task.UserID) + if err == nil { + task.User = user + } if modelarts.FlavorInfos == nil { json.Unmarshal([]byte(setting.FlavorInfos), &modelarts.FlavorInfos) } -- 2.34.1 From 5e7ada52c0f1bcc3a78872e87dac2f1f23140583 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 11:30:00 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- modules/modelarts/modelarts.go | 1 + routers/repo/modelarts.go | 12 ++++++++++- templates/repo/modelarts/notebook/show.tmpl | 24 +++++---------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 538fcfbd90..b1e7b269ef 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -280,6 +280,7 @@ func GenerateNotebook2(ctx *context.Context, displayJobName, jobName, uuid, desc RepoID: ctx.Repo.Repository.ID, JobID: jobResult.ID, JobName: jobName, + FlavorCode: flavor, DisplayJobName: displayJobName, JobType: string(models.JobTypeDebug), Type: models.TypeCloudBrainTwo, diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 4b7582d4b6..1f4a275d18 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -4,6 +4,7 @@ import ( "archive/zip" "encoding/json" "errors" + "fmt" "io" "io/ioutil" "net/http" @@ -291,7 +292,16 @@ func NotebookShow(ctx *context.Context) { if modelarts.FlavorInfos == nil { json.Unmarshal([]byte(setting.FlavorInfos), &modelarts.FlavorInfos) } - ctx.Data["resource_spec"] = modelarts.FlavorInfos.FlavorInfo + if modelarts.FlavorInfos != nil { + ctx.Data["resource_spec"] = modelarts.FlavorInfos.FlavorInfo[0].Desc + for _, f := range modelarts.FlavorInfos.FlavorInfo { + if fmt.Sprint(f.Value) == task.FlavorCode { + ctx.Data["resource_spec"] = f.Desc + break + } + } + } + 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 68c94cdca2..35180cedd9 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -56,7 +56,7 @@ margin:10px 5px ; } .tab_2_content { - min-height: 560px; + min-height: 460px; margin-left: 10px; } .ac-grid { @@ -189,9 +189,9 @@ td, th { {{$.i18n.Tr "repo.modelarts.notebook"}}
/
- -
{{.jobName}}
- + {{with .task}} +
{{.DisplayJobName}}
+ {{end}}
{{with .task}} @@ -241,7 +241,7 @@ td, th {
- {{$.jobName}} + {{.DisplayJobName}}
@@ -297,20 +297,6 @@ td, th { - - - {{$.i18n.Tr "cloudbrain.dataset_storage_path"}} - - - -
- {{$.dataset_path}} -
- - - - -
-- 2.34.1 From b6e31fcd9cd8b830a1c1d286582a758330412e51 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 14:22:47 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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 1f4a275d18..3f835ee5d8 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 35180cedd9..f8122beadf 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}}
-- 2.34.1 From 3bd8962f72f9bd2736c8b1949e1dbb758f5ad1c6 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 14:30:02 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 48 +++++++++++---------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index f8122beadf..93116944bb 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -274,6 +274,21 @@ td, th { + + + + {{$.i18n.Tr "admin.auths.updated"}} + + + +
+ + {{TimeSinceUnix1 .UpdatedUnix}} + +
+ + + {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} @@ -285,6 +300,15 @@ td, th { + + + + + +
+ + + - -
{{$.i18n.Tr "cloudbrain.mirror"}} @@ -297,30 +321,8 @@ td, th {
-
-
- - - - - - - - - + diff --git a/templates/repo/modelarts/notebook/show--.tmpl-- b/templates/repo/modelarts/notebook/show--.tmpl-- deleted file mode 100644 index 59474ee496..0000000000 --- a/templates/repo/modelarts/notebook/show--.tmpl-- +++ /dev/null @@ -1,68 +0,0 @@ -{{template "base/head" .}} -
-{{template "repo/header" .}} -
-
- {{template "base/alert" .}} - -

- -

-
-
- {{with .task}} -

任务名称: {{.DisplayJobName}}

- {{end}} -
-
-

任务详情:

- {{with .result}} -
- {{$.i18n.Tr "repo.cloudbrain.endtime"}} - -
- {{if not (eq .StartTime 0)}} - {{TimeSinceUnix1 .EndTime}} - {{else}} - -- - {{end}} -
-
{{$.i18n.Tr "repo.modelarts.train_job.dataset"}} -- 2.34.1 From ec2e7a7a93a6240f681051e395483456b028a164 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 15:03:26 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 12 ++++ templates/repo/cloudbrain/show.tmpl | 4 +- .../repo/modelarts/notebook/show--.tmpl-- | 68 ------------------- 3 files changed, 14 insertions(+), 70 deletions(-) delete mode 100644 templates/repo/modelarts/notebook/show--.tmpl-- diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 73b1914e54..10497d720b 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -417,6 +417,18 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo return } + if cloudbrain.ResourceSpecs == nil { + json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) + } + for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { + if tmp.Id == task.ResourceSpecId { + ctx.Data["GpuNum"] = tmp.GpuNum + ctx.Data["CpuNum"] = tmp.CpuNum + ctx.Data["MemMiB"] = tmp.MemMiB + ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB + } + } + if result != nil { jobRes, _ := models.ConvertToJobResultPayload(result.Payload) jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB") diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index 895a5c14f5..fb8e049963 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -357,7 +357,7 @@ td, th {
- {{if not (eq .StartTime 0)}} + {{if not (eq .EndTime 0)}} {{TimeSinceUnix1 .EndTime}} {{else}} -- @@ -386,7 +386,7 @@ td, th {
- {{$.resource_spec}} + {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{$.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{$.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{$.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{$.ShareMemMiB}}
- - - - - - - - - - - - - - - - - - - - - - - - - - -
状态 {{.Status}}
描述 {{$.task.Description}}
镜像名称 {{$.task.Image}}
数据集下载地址 {{$.datasetDownloadLink}}
开始时间 {{.CreateTime}}
最后更新时间 {{.LatestUpdateTime}}
- {{end}} -
- - - - - - -{{template "base/footer" .}} -- 2.34.1 From 90ea5dc8d29b470b798ce63c1eef2a72e5f90e1c Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 15:26:33 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 9 +++++++++ templates/repo/cloudbrain/show.tmpl | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 10497d720b..cb16a6b0df 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -429,6 +429,15 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo } } + if gpuInfos == nil { + json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos) + } + for _, tmp := range gpuInfos.GpuInfo { + if tmp.Queue == task.GpuQueue { + ctx.Data["gpu_type"] = tmp.Value + } + } + if result != nil { jobRes, _ := models.ConvertToJobResultPayload(result.Payload) jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB") diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index fb8e049963..76927c7f14 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -330,12 +330,12 @@ td, th { - {{$.i18n.Tr "repo.cloudbrain.platform"}} + {{$.i18n.Tr "cloudbrain.gpu_type"}}
- {{$.result.Platform}} + {{$.gpu_type}}
-- 2.34.1 From 9dee6a695e80a7442e4c9848f938c381ee268122 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 15:28:02 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/notebook/show.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 93116944bb..684ad99a16 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -330,7 +330,7 @@ td, th {
- {{.DatasetName}} + {{.DatasetName}}
-- 2.34.1 From 58192375b3a154c44ef2a90b5f0d4b212fc203b4 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 15:52:29 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 1 - models/user_business_struct.go | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index db226b14b4..65ce642d54 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -720,7 +720,6 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, useMetrics.NotActivateRegistUser = getMapKeyStringValue("NotActivateRegistUser", userMetrics) useMetrics.TotalActivateRegistUser = getMapKeyStringValue("TotalActivateRegistUser", userMetrics) useMetrics.TotalHasActivityUser = getMapKeyStringValue("TotalHasActivityUser", userMetrics) - useMetrics.DataDate = currentTimeNow.Format("2006-01-02 15:04:05") statictisSess.Insert(&useMetrics) return nil diff --git a/models/user_business_struct.go b/models/user_business_struct.go index 1a7625d827..17d9f046f6 100644 --- a/models/user_business_struct.go +++ b/models/user_business_struct.go @@ -344,11 +344,10 @@ type UserAnalysisPara struct { } type UserMetrics struct { - CountDate int64 `xorm:"pk"` - ActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - NotActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - HasActivityUser int `xorm:"NOT NULL DEFAULT 0"` - TotalActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` - TotalHasActivityUser int `xorm:"NOT NULL DEFAULT 0"` - DataDate string `xorm:"NULL"` + CountDate int64 `xorm:"pk"` + ActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + NotActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + HasActivityUser int `xorm:"NOT NULL DEFAULT 0"` + TotalActivateRegistUser int `xorm:"NOT NULL DEFAULT 0"` + TotalHasActivityUser int `xorm:"NOT NULL DEFAULT 0"` } -- 2.34.1 From 1a3b0ad9b67392f739c4e6460e9b9b546e3de98b Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 7 Apr 2022 15:59:49 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 9 --------- templates/repo/cloudbrain/show.tmpl | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 516b25576d..2848b8e19e 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -447,15 +447,6 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo } } - if gpuInfos == nil { - json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos) - } - for _, tmp := range gpuInfos.GpuInfo { - if tmp.Queue == task.GpuQueue { - ctx.Data["gpu_type"] = tmp.Value - } - } - if result != nil { jobRes, _ := models.ConvertToJobResultPayload(result.Payload) jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB") diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index 76927c7f14..781c66d671 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -335,7 +335,7 @@ td, th {
- {{$.gpu_type}} + {{$.resource_type}}
-- 2.34.1