From 755688bb6f857f3a7830c3110b91e47ae20db264 Mon Sep 17 00:00:00 2001
From: zouap
Date: Tue, 15 Feb 2022 17:04:06 +0800
Subject: [PATCH 01/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E9=80=9A=E7=9F=A5=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
models/action.go | 2 ++
modules/notification/action/action.go | 15 +++++++++++++++
modules/notification/base/notifier.go | 2 ++
modules/notification/base/null.go | 4 ++++
modules/notification/notification.go | 7 +++++++
routers/repo/attachment.go | 4 +++-
6 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/models/action.go b/models/action.go
index 003dc1b205..deb16f6c32 100755
--- a/models/action.go
+++ b/models/action.go
@@ -49,6 +49,8 @@ const (
ActionApprovePullRequest // 21
ActionRejectPullRequest // 22
ActionCommentPull // 23
+
+ ActionUploadAttachment //24
)
// Action represents user operation type and other information to
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 9956940f30..ba279a3c70 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -314,3 +314,18 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
log.Error("notifyWatchers: %v", err)
}
}
+
+func NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+ if err := models.NotifyWatchers(&models.Action{
+ ActUserID: repo.OwnerID,
+ ActUser: repo.MustOwner(),
+ OpType: models.ActionUploadAttachment,
+ RepoID: repo.ID,
+ Repo: repo,
+ IsPrivate: repo.IsPrivate,
+ RefName: attachment.Name,
+ Content: attachment.UUID,
+ }); err != nil {
+ log.Error("notifyWatchers: %v", err)
+ }
+}
diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go
index 0b3e1173b3..95331131f2 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -53,4 +53,6 @@ type Notifier interface {
NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits)
NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string)
NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string)
+
+ NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment)
}
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index d2fd51d713..6450c1f0f5 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -150,3 +150,7 @@ func (*NullNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Reposit
// NotifySyncDeleteRef places a place holder function
func (*NullNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
}
+
+func (*NullNotifier) NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+
+}
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index d120246634..7b0203a5c6 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -37,6 +37,13 @@ func NewContext() {
RegisterNotifier(action.NewNotifier())
}
+// NotifyUploadAttachment notifies attachment upload message to notifiers
+func NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+ for _, notifier := range notifiers {
+ notifier.NotifyUploadAttachment(doer, repo, attachment)
+ }
+}
+
// NotifyCreateIssueComment notifies issue comment related message to notifiers
func NotifyCreateIssueComment(doer *models.User, repo *models.Repository,
issue *models.Issue, comment *models.Comment) {
diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go
index 8443d6488e..dc15be9f1c 100755
--- a/routers/repo/attachment.go
+++ b/routers/repo/attachment.go
@@ -20,11 +20,11 @@ import (
"code.gitea.io/gitea/modules/labelmsg"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/minio_ext"
+ "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/upload"
"code.gitea.io/gitea/modules/worker"
-
gouuid "github.com/satori/go.uuid"
)
@@ -846,6 +846,8 @@ func CompleteMultipart(ctx *context.Context) {
return
}
+ notification.NotifyUploadAttachment(ctx.User, ctx.Repo.Repository, attachment)
+
if attachment.DatasetID != 0 {
if isCanDecompress(attachment.Name) {
if typeCloudBrain == models.TypeCloudBrainOne {
--
2.34.1
From d1f43bf7f51766eff183161908e85703c620cfc3 Mon Sep 17 00:00:00 2001
From: zouap
Date: Tue, 15 Feb 2022 17:14:41 +0800
Subject: [PATCH 02/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E9=80=9A=E7=9F=A5=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
modules/notification/action/action.go | 2 +-
modules/notification/notification.go | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index ba279a3c70..4c40df114a 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -315,7 +315,7 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
}
}
-func NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+func (a *actionNotifier) NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
if err := models.NotifyWatchers(&models.Action{
ActUserID: repo.OwnerID,
ActUser: repo.MustOwner(),
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index 7b0203a5c6..3179dd5f9f 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -6,6 +6,7 @@ package notification
import (
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification/action"
"code.gitea.io/gitea/modules/notification/base"
"code.gitea.io/gitea/modules/notification/indexer"
@@ -39,7 +40,9 @@ func NewContext() {
// NotifyUploadAttachment notifies attachment upload message to notifiers
func NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+ log.Info("send attachment to db.")
for _, notifier := range notifiers {
+ log.Info("send attachment to notifiers.")
notifier.NotifyUploadAttachment(doer, repo, attachment)
}
}
--
2.34.1
From 075516d5ab43f296ca2991112a02c07ba9f5bbde Mon Sep 17 00:00:00 2001
From: zouap
Date: Tue, 15 Feb 2022 17:21:57 +0800
Subject: [PATCH 03/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E9=80=9A=E7=9F=A5=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
modules/notification/action/action.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 4c40df114a..cc86d927a3 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -318,7 +318,7 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
func (a *actionNotifier) NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
if err := models.NotifyWatchers(&models.Action{
ActUserID: repo.OwnerID,
- ActUser: repo.MustOwner(),
+ ActUser: doer,
OpType: models.ActionUploadAttachment,
RepoID: repo.ID,
Repo: repo,
--
2.34.1
From 9c460221646f6d7aefc469341c76118144d9abb5 Mon Sep 17 00:00:00 2001
From: zouap
Date: Tue, 15 Feb 2022 17:54:03 +0800
Subject: [PATCH 04/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E9=80=9A=E7=9F=A5=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
routers/repo/attachment.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go
index dc15be9f1c..91c0e7d281 100755
--- a/routers/repo/attachment.go
+++ b/routers/repo/attachment.go
@@ -845,8 +845,9 @@ func CompleteMultipart(ctx *context.Context) {
ctx.Error(500, fmt.Sprintf("InsertAttachment: %v", err))
return
}
-
- notification.NotifyUploadAttachment(ctx.User, ctx.Repo.Repository, attachment)
+ dataset, _ := models.GetDatasetByID(attachment.DatasetID)
+ repository, _ := models.GetRepositoryByID(dataset.RepoID)
+ notification.NotifyUploadAttachment(ctx.User, repository, attachment)
if attachment.DatasetID != 0 {
if isCanDecompress(attachment.Name) {
@@ -867,7 +868,6 @@ func CompleteMultipart(ctx *context.Context) {
labelmsg.SendDecompressAttachToLabelOBS(string(attachjson))
}
} else {
- dataset, _ := models.GetDatasetByID(attachment.DatasetID)
var labelMap map[string]string
labelMap = make(map[string]string)
labelMap["UUID"] = uuid
--
2.34.1
From ce27bf3d25e81b157fca8827343988d15e13884b Mon Sep 17 00:00:00 2001
From: zouap
Date: Wed, 16 Feb 2022 15:33:26 +0800
Subject: [PATCH 05/24] =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
models/action.go | 8 +++++++-
modules/cloudbrain/cloudbrain.go | 13 ++++++++++---
modules/modelarts/modelarts.go | 15 ++++++++-------
modules/notification/action/action.go | 8 ++++----
modules/notification/base/notifier.go | 2 +-
modules/notification/base/null.go | 2 +-
modules/notification/notification.go | 4 ++--
options/locale/locale_en-US.ini | 1 +
options/locale/locale_zh-CN.ini | 2 +-
routers/repo/ai_model_manage.go | 3 ++-
routers/repo/attachment.go | 2 +-
routers/repo/cloudbrain.go | 2 +-
services/socketwrap/clientManager.go | 2 +-
templates/user/dashboard/feeds.tmpl | 20 ++++++++++++++++++++
14 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/models/action.go b/models/action.go
index deb16f6c32..95d87206fc 100755
--- a/models/action.go
+++ b/models/action.go
@@ -50,7 +50,13 @@ const (
ActionRejectPullRequest // 22
ActionCommentPull // 23
- ActionUploadAttachment //24
+ ActionUploadAttachment //24
+ ActionCreateDebugGPUTask //25
+ ActionCreateDebugNPUTask //26
+ ActionCreateTrainTask //27
+ ActionCreateInferenceTask // 28
+ ActionCreateBenchMarkTask //29
+ ActionCreateNewModelTask //30
)
// Action represents user operation type and other information to
diff --git a/modules/cloudbrain/cloudbrain.go b/modules/cloudbrain/cloudbrain.go
index f15443b30e..b86a2d3f42 100755
--- a/modules/cloudbrain/cloudbrain.go
+++ b/modules/cloudbrain/cloudbrain.go
@@ -1,16 +1,17 @@
package cloudbrain
import (
- "code.gitea.io/gitea/modules/storage"
"encoding/json"
"errors"
"strconv"
- "code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/notification"
+ "code.gitea.io/gitea/modules/setting"
)
const (
@@ -221,13 +222,19 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath,
ComputeResource: models.GPUResource,
BenchmarkTypeID: benchmarkTypeID,
BenchmarkChildTypeID: benchmarkChildTypeID,
- Description: description,
+ Description: description,
})
if err != nil {
return err
}
+ if string(models.JobTypeBenchmark) == jobType {
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, jobName, models.ActionCreateBenchMarkTask)
+ } else {
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, jobName, models.ActionCreateDebugGPUTask)
+ }
+
return nil
}
diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go
index 8af2a93e5e..dffe7d05eb 100755
--- a/modules/modelarts/modelarts.go
+++ b/modules/modelarts/modelarts.go
@@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
)
@@ -258,7 +259,7 @@ func GenerateTask(ctx *context.Context, jobName, uuid, description, flavor strin
if err != nil {
return err
}
-
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobResult.ID, jobName, models.ActionCreateDebugNPUTask)
return nil
}
@@ -292,12 +293,12 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error
log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error())
return err
}
-
+ jobId := strconv.FormatInt(jobResult.JobID, 10)
err = models.CreateCloudbrain(&models.Cloudbrain{
Status: TransTrainJobStatus(jobResult.Status),
UserID: ctx.User.ID,
RepoID: ctx.Repo.Repository.ID,
- JobID: strconv.FormatInt(jobResult.JobID, 10),
+ JobID: jobId,
JobName: req.JobName,
JobType: string(models.JobTypeTrain),
Type: models.TypeCloudBrainTwo,
@@ -328,7 +329,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error
log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error())
return err
}
-
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobId, req.JobName, models.ActionCreateTrainTask)
return nil
}
@@ -512,12 +513,12 @@ func GenerateInferenceJob(ctx *context.Context, req *GenerateInferenceJobReq) (e
log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error())
return err
}
-
+ jobID := strconv.FormatInt(jobResult.JobID, 10)
err = models.CreateCloudbrain(&models.Cloudbrain{
Status: TransTrainJobStatus(jobResult.Status),
UserID: ctx.User.ID,
RepoID: ctx.Repo.Repository.ID,
- JobID: strconv.FormatInt(jobResult.JobID, 10),
+ JobID: jobID,
JobName: req.JobName,
JobType: string(models.JobTypeInference),
Type: models.TypeCloudBrainTwo,
@@ -552,6 +553,6 @@ func GenerateInferenceJob(ctx *context.Context, req *GenerateInferenceJobReq) (e
log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error())
return err
}
-
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, req.JobName, models.ActionCreateInferenceTask)
return nil
}
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index cc86d927a3..9adc0eac15 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -315,16 +315,16 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
}
}
-func (a *actionNotifier) NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+func (a *actionNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
if err := models.NotifyWatchers(&models.Action{
ActUserID: repo.OwnerID,
ActUser: doer,
- OpType: models.ActionUploadAttachment,
+ OpType: optype,
RepoID: repo.ID,
Repo: repo,
IsPrivate: repo.IsPrivate,
- RefName: attachment.Name,
- Content: attachment.UUID,
+ RefName: name,
+ Content: id,
}); err != nil {
log.Error("notifyWatchers: %v", err)
}
diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go
index 95331131f2..4a8e16f184 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -54,5 +54,5 @@ type Notifier interface {
NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string)
NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string)
- NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment)
+ NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string)
}
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index 6450c1f0f5..792dfe6b83 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -151,6 +151,6 @@ func (*NullNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Reposit
func (*NullNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
}
-func (*NullNotifier) NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+func (*NullNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
}
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index 3179dd5f9f..92b108e3bc 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -39,11 +39,11 @@ func NewContext() {
}
// NotifyUploadAttachment notifies attachment upload message to notifiers
-func NotifyUploadAttachment(doer *models.User, repo *models.Repository, attachment *models.Attachment) {
+func NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
log.Info("send attachment to db.")
for _, notifier := range notifiers {
log.Info("send attachment to notifiers.")
- notifier.NotifyUploadAttachment(doer, repo, attachment)
+ notifier.NotifyOtherTask(doer, repo, id, name, optype)
}
}
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 739d515bc7..a42af28246 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2638,6 +2638,7 @@ mirror_sync_create = synced new reference %[2]s to %[2]s at %[3]s from mirror
approve_pull_request = `approved %s#%[2]s`
reject_pull_request = `suggested changes for %s#%[2]s`
+upload_dataset=`upload dataset %s#%[2]s`
[tool]
ago = %s ago
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 935b6112b8..4cf2d330ac 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -2646,7 +2646,7 @@ mirror_sync_create=从镜像同步了新的引用 %[2]s
mirror_sync_delete=从镜像同步并从 %[3]s 删除了引用 %[2]s
approve_pull_request=`同意了 %s#%[2]s`
reject_pull_request=`建议变更 %s#%[2]s`
-
+upload_dataset=`上传了数据集 %s#%[2]s`
[tool]
ago=%s前
from_now=%s 之后
diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go
index fe4d9794c9..e2040e0d23 100644
--- a/routers/repo/ai_model_manage.go
+++ b/routers/repo/ai_model_manage.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
uuid "github.com/satori/go.uuid"
@@ -113,7 +114,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
models.UpdateRepositoryUnits(ctx.Repo.Repository, units, deleteUnitTypes)
log.Info("save model end.")
-
+ notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, id, name, models.ActionCreateNewModelTask)
return nil
}
diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go
index 91c0e7d281..d5d73c7e42 100755
--- a/routers/repo/attachment.go
+++ b/routers/repo/attachment.go
@@ -847,7 +847,7 @@ func CompleteMultipart(ctx *context.Context) {
}
dataset, _ := models.GetDatasetByID(attachment.DatasetID)
repository, _ := models.GetRepositoryByID(dataset.RepoID)
- notification.NotifyUploadAttachment(ctx.User, repository, attachment)
+ notification.NotifyOtherTask(ctx.User, repository, fmt.Sprint(attachment.Type), attachment.Name, models.ActionUploadAttachment)
if attachment.DatasetID != 0 {
if isCanDecompress(attachment.Name) {
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 6621081fd6..f48d724d44 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -445,7 +445,7 @@ func CloudBrainStop(ctx *context.Context) {
task := ctx.Cloudbrain
for {
- if task.Status == string(models.JobStopped) || task.Status == string(models.JobFailed) || task.Status == string(models.JobSucceeded){
+ if task.Status == string(models.JobStopped) || task.Status == string(models.JobFailed) || task.Status == string(models.JobSucceeded) {
log.Error("the job(%s) has been stopped", task.JobName, ctx.Data["msgID"])
resultCode = "-1"
errorMsg = "system error"
diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go
index 601c0f7a83..09c816c163 100644
--- a/services/socketwrap/clientManager.go
+++ b/services/socketwrap/clientManager.go
@@ -10,7 +10,7 @@ import (
"github.com/elliotchance/orderedmap"
)
-var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23}
+var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23, 24, 25, 26, 27, 28, 29, 30}
type ClientsManager struct {
Clients *orderedmap.OrderedMap
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index a1b4218dc4..09baa10e6b 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -69,6 +69,26 @@
{{$.i18n.Tr "action.reject_pull_request" .GetRepoLink $index .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 23}}
{{ $index := index .GetIssueInfos 0}}
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 24}}
+ {{$.i18n.Tr "action.upload_dataset" .GetRepoLink .Content .RefName | Str2html}}
+ {{else if eq .GetOpType 25}}
+
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 26}}
+
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 27}}
+
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 28}}
+
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 29}}
+
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 30}}
+
{{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
{{end}}
--
2.34.1
From 55fbf7fbbf9074f8c01d44dcd7be6a14814b630d Mon Sep 17 00:00:00 2001
From: zouap
Date: Wed, 16 Feb 2022 17:12:05 +0800
Subject: [PATCH 06/24] =?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
---
custom/public/css/git.openi.css | 153 +++++++++++++++++++++++---
modules/notification/base/notifier.go | 2 +-
options/locale/locale_en-US.ini | 6 +
options/locale/locale_zh-CN.ini | 9 +-
templates/user/dashboard/feeds.tmpl | 18 +--
5 files changed, 158 insertions(+), 30 deletions(-)
diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css
index 502ba8d887..b849d0cd44 100644
--- a/custom/public/css/git.openi.css
+++ b/custom/public/css/git.openi.css
@@ -44,6 +44,12 @@
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
+.ui.label{
+ font-weight: normal;
+}
+.active {
+ color: #0366D6 !important;
+}
.opacity5{ opacity:0.5;}
.radius15{ border-radius:1.5rem !important; }
@@ -250,9 +256,13 @@
box-shadow: none !important;
}
.homeorg-list .card .ui.small.header .content{
- width: calc(100% - 3.25em);
+ width: calc(100% - 3.75em);
+}
+.homepro-tit{
+ z-index: 9;
+ position: relative;
}
-.homepro-list{
+.homepro-list, .homeorg-list{
position: relative;
z-index: 9;
padding: 1.0em 1.0em 3.0em;
@@ -261,42 +271,153 @@
.homepro-list .ui.card{
border-radius: 15px;
background-color: #FFF;
- box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, 30);
- border: 1px solid rgba(105, 192, 255, 40);
+ box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, .3);
+ border: 1px solid rgba(105, 192, 255, .4);
min-height: 10.8em;
}
.homepro-list .ui.card>.content>.header{
line-height: 40px !important;
}
-.homepro-list .swiper-pagination-bullet-active{
+.homepro-list .swiper-pagination-bullet-active, .homeorg-list .swiper-pagination-bullet-active{
width: 40px;
- border-radius: 4px;
+ border-radius: 4px;
}
.i-env > div{
position: relative;
}
+/**seach**/
+/**搜索导航条适配窄屏**/
+.seachnav{
+ overflow-x: auto;
+ overflow-y: hidden;
+ scrollbar-width: none; /* firefox */
+ -ms-overflow-style: none; /* IE 10+ */
+}
+.seachnav::-webkit-scrollbar {
+ display: none; /* Chrome Safari */
+}
+.ui.green.button, .ui.green.buttons .button{
+ background-color: #5BB973;
+}
+.seach .repos--seach{
+ padding-bottom: 0;
+ border-bottom: none;
+}
+.seach .ui.secondary.pointing.menu{
+ border-bottom: none;
+}
+.seach .ui.secondary.pointing.menu .item > i{
+ margin-right: 5px;
+}
+.seach .ui.secondary.pointing.menu .active.item{
+ border-bottom-width: 2px;
+ margin: 0 0 -1px;
+}
+.seach .ui.menu .active.item>.label {
+ background: #1684FC;
+ color: #FFF;
+}
+.seach .ui.menu .item>.label:not(.active.item>.label) {
+ background: #e8e8e8;
+ color: rgba(0,0,0,.6);
+}
+
+.highlight{
+ color: red;
+}
+.ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content {
+ width: calc(100% - 3.0em);
+ margin-left: 0;
+}
+
+.seach .ui.list .list>.item .header, .seach .ui.list>.item .header{
+ margin-bottom: 0.5em;
+ font-size: 1.4rem !important;
+ font-weight: normal;
+}
+.seach .time, .seach .time a{
+ font-size: 12px;
+ color: grey;
+}
+
+.seach .list .item.members .ui.avatar.image {
+ width: 3.2em;
+ height: 3.2em;
+}
+.ui.list .list>.item.members>img.image+.content, .ui.list>.item.members>img.image+.content {
+ width: calc(100% - 4.0em);
+ margin-left: 0;
+}
+
@media only screen and (max-width: 767px) {
.am-mt-30{ margin-top: 1.5rem !important;}
.ui.secondary.hometop.segment{
- margin-bottom: 2.0rem;
+ margin-bottom: 5.0rem;
}
- .bannerpic, .i-code-pic{
+ .bannerpic{
display: none;
}
- .i-code h2::before {
- left: calc(-5.0rem + 6px);
+ #homenews{
+ bottom: -3em;
}
- .i-code h2.am-bw::before{
- left: calc(-4.0rem + 6px);
+ #homenews > p {
+ margin-left: 1.0em;
+ }
+ .homenews{
+ padding-left: 1.3em !important;
+ border-radius: 1.5em;
+ }
+ .homenews::before{
+ left: 2em;
+ }
+ .homepro-tit > p{
+ background: #FFF;
+ }
+ .homeorg{
+ padding-left: 3.5em;
+ }
+ .homeorg-tit::after {
+ left: -2.3em;
+ }
+ .homeorg-list{
+ margin: 0 0 2.0em !important;
+ }
+ .homeorg-list > .column{
+ width: 3em !important;
+ margin-left: -0.5em;
+ padding: 0.5rem 0 0 !important;
+ }
+ .homeorg-list .card{
+ background: none !important;
+ }
+ .homeorg-list .card > .content{
+ padding: 0 !important;
+ }
+
+ .homeorg-list > .column .card .ui.header>img{
+ width: 3.0em;
+ height: 3.0em;
+ border-radius: 2.0em;
+ border: 2px solid #FFF;
+ }
+ .homeorg-list > .column .card .ui.header > .content{
+ display: none;
}
.leftline01{
- width: calc(50% - 4.0rem);
+ width: 4.0em;
+ bottom: 4em;
+ border-radius: 0 0 0 3.0em;
+ }
+ .leftline02, .leftline02-2{
+ left: 6.0em;
+ top: calc(-4.0em - 2px);
+ border-radius: 0 3.0em 3.0em 0;
+ width: calc(50% - 6.0em);
}
- .leftline02{
- left: calc(50% - 1.0rem);
- top: calc(-3.5rem - 2px);
+ .leftline02-2 {
+ width: calc(50% - 8.0em);
}
}
diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go
index 4a8e16f184..8f5436c750 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -54,5 +54,5 @@ type Notifier interface {
NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string)
NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string)
- NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string)
+ NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType)
}
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index a42af28246..c768ad0051 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2639,6 +2639,12 @@ mirror_sync_delete = synced and deleted reference %[2]s
at %s#%[2]s`
reject_pull_request = `suggested changes for %s#%[2]s`
upload_dataset=`upload dataset %s#%[2]s`
+task_gpudebugjob=`created CPU/GPU type debugging task%s#%[2]s`
+task_npudebugjob=`created NPU type debugging task %s#%[2]s`
+task_trainjob=`created training task%s#%[2]s`
+task_inferencejob=`created reasoning task %s#%[2]s`
+task_benchmark=`created profiling task %s#%[2]s`
+task_createmodel=`created new model %s#%[2]s`
[tool]
ago = %s ago
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 4cf2d330ac..bddff4ac6c 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -2646,7 +2646,14 @@ mirror_sync_create=从镜像同步了新的引用 %[2]s
mirror_sync_delete=从镜像同步并从 %[3]s 删除了引用 %[2]s
approve_pull_request=`同意了 %s#%[2]s`
reject_pull_request=`建议变更 %s#%[2]s`
-upload_dataset=`上传了数据集 %s#%[2]s`
+upload_dataset=`上传了数据集文件 %s#%[2]s`
+task_gpudebugjob=`创建了CPU/GPU类型调试任务 %s#%[2]s`
+task_npudebugjob=`创建了NPU类型调试任务 %s#%[2]s`
+task_trainjob=`创建了训练任务 %s#%[2]s`
+task_inferencejob=`创建了推理任务 %s#%[2]s`
+task_benchmark=`创建了评测任务 %s#%[2]s`
+task_createmodel=`导入了新模型 %s#%[2]s`
+
[tool]
ago=%s前
from_now=%s 之后
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 09baa10e6b..55d9ca7f61 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -73,23 +73,17 @@
{{else if eq .GetOpType 24}}
{{$.i18n.Tr "action.upload_dataset" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 25}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_gpudebugjob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 26}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_npudebugjob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 27}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_trainjob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 28}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_inferencejob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 29}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_benchmark" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 30}}
-
- {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{$.i18n.Tr "action.task_createmodel" .GetRepoLink .RefName .RefName | Str2html}}
{{end}}
{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}
--
2.34.1
From 9003ab4ddb6037efe29abb81d78d993a383552c8 Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 10:25:30 +0800
Subject: [PATCH 07/24] =?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
---
options/locale/locale_en-US.ini | 14 +++++++-------
options/locale/locale_zh-CN.ini | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index c768ad0051..7b2bb0f343 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2638,13 +2638,13 @@ mirror_sync_create = synced new reference %[2]s to %[2]s at %[3]s from mirror
approve_pull_request = `approved %s#%[2]s`
reject_pull_request = `suggested changes for %s#%[2]s`
-upload_dataset=`upload dataset %s#%[2]s`
-task_gpudebugjob=`created CPU/GPU type debugging task%s#%[2]s`
-task_npudebugjob=`created NPU type debugging task %s#%[2]s`
-task_trainjob=`created training task%s#%[2]s`
-task_inferencejob=`created reasoning task %s#%[2]s`
-task_benchmark=`created profiling task %s#%[2]s`
-task_createmodel=`created new model %s#%[2]s`
+upload_dataset=`upload dataset %`
+task_gpudebugjob=`created CPU/GPU type debugging task%s`
+task_npudebugjob=`created NPU type debugging task %s`
+task_trainjob=`created training task%s`
+task_inferencejob=`created reasoning task %s`
+task_benchmark=`created profiling task %s`
+task_createmodel=`created new model %s`
[tool]
ago = %s ago
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index bddff4ac6c..3646c5721c 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -2646,13 +2646,13 @@ mirror_sync_create=从镜像同步了新的引用 %[2]s
mirror_sync_delete=从镜像同步并从 %[3]s 删除了引用 %[2]s
approve_pull_request=`同意了 %s#%[2]s`
reject_pull_request=`建议变更 %s#%[2]s`
-upload_dataset=`上传了数据集文件 %s#%[2]s`
-task_gpudebugjob=`创建了CPU/GPU类型调试任务 %s#%[2]s`
-task_npudebugjob=`创建了NPU类型调试任务 %s#%[2]s`
-task_trainjob=`创建了训练任务 %s#%[2]s`
-task_inferencejob=`创建了推理任务 %s#%[2]s`
-task_benchmark=`创建了评测任务 %s#%[2]s`
-task_createmodel=`导入了新模型 %s#%[2]s`
+upload_dataset=`上传了数据集文件 %s`
+task_gpudebugjob=`创建了CPU/GPU类型调试任务 %s`
+task_npudebugjob=`创建了NPU类型调试任务 %s`
+task_trainjob=`创建了训练任务 %s`
+task_inferencejob=`创建了推理任务 %s`
+task_benchmark=`创建了评测任务 %s`
+task_createmodel=`导入了新模型 %s`
[tool]
ago=%s前
--
2.34.1
From aac79cc0fd7f54fc262e1c63d6d8117512c073f2 Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 11:43:39 +0800
Subject: [PATCH 08/24] =?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
---
options/locale/locale_en-US.ini | 2 +-
public/home/home.js | 52 +++++++++++++++++++++++++--------
2 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 7b2bb0f343..156cc4b38f 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2638,7 +2638,7 @@ mirror_sync_create = synced new reference %[2]s to %[2]s at %[3]s from mirror
approve_pull_request = `approved %s#%[2]s`
reject_pull_request = `suggested changes for %s#%[2]s`
-upload_dataset=`upload dataset %`
+upload_dataset=`upload dataset %s`
task_gpudebugjob=`created CPU/GPU type debugging task%s`
task_npudebugjob=`created NPU type debugging task %s`
task_trainjob=`created training task%s`
diff --git a/public/home/home.js b/public/home/home.js
index 3312307bd3..fcdd39a5c7 100644
--- a/public/home/home.js
+++ b/public/home/home.js
@@ -103,11 +103,14 @@ socket.onmessage = function (e) {
actionName = actionName.replace("{oldRepoName}",record.Content);
html += recordPrefix + actionName;
html += " " + getRepoLink(record) + ""
+ }
+ else if(record.OpType == "24" || record.OpType == "25" || record.OpType == "26" || record.OpType == "27" || record.OpType == "28" || record.OpType == "29" || record.OpType == "30"){
+ html += recordPrefix + actionName;
+ html += " " + record.RefName + ""
}
else{
continue;
}
-
if(record.Repo != null){
var time = getTime(record.CreatedUnix,currentTime);
html += " " + time;
@@ -115,15 +118,6 @@ socket.onmessage = function (e) {
html += "";
html += "";
}
- /*
-
-
-
-
- */
-
}
console.log("html=" + html)
output.innerHTML = html;
@@ -131,6 +125,26 @@ socket.onmessage = function (e) {
swiperNewMessage.updateProgress();
};
+function getTaskLink(record){
+ var re = getRepoLink(record);
+ if(record.OpType == 24){
+ return re + "/datasets?type=" + record.Content;
+ }else if(record.OpType == 25){
+ return re + "/cloudbrain/" + record.Content;
+ }else if(record.OpType == 26){
+ return re + "/modelarts/notebook/" + record.Content;
+ }else if(record.OpType == 27){
+ return re + "/modelarts/train-job/" + record.Content;
+ }else if(record.OpType == 28){
+ return re + "/modelarts/inference-job/" + record.Content;
+ }else if(record.OpType == 29){
+ return re + "/cloudbrain/benchmark/" + record.Content;
+ }else if(record.OpType == 30){
+ return re + "/modelmanage/show_model_info?name=" + record.RefName;
+ }
+ return re;
+}
+
function getMsg(record){
var html ="";
html += "";
@@ -248,7 +262,14 @@ var actionNameZH={
"15":"重新开启了合并请求",
"17":"从 {repoName} 删除分支 {deleteBranchName}",
"22":"建议变更",
- "23":"评论了合并请求"
+ "23":"评论了合并请求",
+ "24":"上传了数据集文件",
+ "25":"创建了CPU/GPU类型调试任务",
+ "26":"创建了NPU类型调试任务",
+ "27":"创建了训练任务",
+ "28":"创建了推理任务",
+ "29":"创建了评测任务",
+ "30":"导入了新模型"
};
var actionNameEN={
@@ -266,7 +287,14 @@ var actionNameEN={
"15":" reopened pull request",
"17":" deleted branch {deleteBranchName} from {repoName}",
"22":" proposed changes",
- "23":" commented on pull request"
+ "23":" commented on pull request",
+ "24":" upload dataset ",
+ "25":" created CPU/GPU type debugging task ",
+ "26":" created NPU type debugging task ",
+ "27":" created training task",
+ "28":" created reasoning task",
+ "29":" created profiling task",
+ "30":" created new model"
};
var repoAndOrgZH={
--
2.34.1
From 53dd2b0a8b0fc1e070a454d14fd6d171c878aabf Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 15:18:24 +0800
Subject: [PATCH 09/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E3=80=82=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
templates/user/dashboard/feeds.tmpl | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 20c9bd91b8..8c2715613c 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -115,7 +115,23 @@
- {{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32}}
+ {{if eq .GetOpType 24}}
+
+ {{else if eq .GetOpType 25}}
+
+ {{else if eq .GetOpType 26}}
+
+ {{else if eq .GetOpType 27}}
+
+ {{else if eq .GetOpType 28}}
+
+ {{else if eq .GetOpType 29}}
+
+ {{else if eq .GetOpType 30}}
+
+ {{else}}
+ {{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32}}
+ {{end}}
--
2.34.1
From c6464007d8a3da73aa45160c807a280701de00ed Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 16:20:25 +0800
Subject: [PATCH 10/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=87=BA=E9=94=99=E6=97=B6=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
routers/repo/cloudbrain.go | 3 +++
templates/repo/cloudbrain/benchmark/new.tmpl | 16 +++++++++++++---
templates/user/dashboard/feeds.tmpl | 2 +-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 0599fb03f1..88fea0d8f7 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -1200,6 +1200,9 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF
benchmarkTypeID := form.BenchmarkTypeID
benchmarkChildTypeID := form.BenchmarkChildTypeID
+ ctx.Data["description"] = form.Description
+ ctx.Data["benchmarkTypeID"] = benchmarkTypeID
+ ctx.Data["benchmark_child_types_id_hidden"] = benchmarkChildTypeID
if !jobNamePattern.MatchString(jobName) {
cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplCloudBrainBenchmarkNew, &form)
diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl
index 081e44e48d..6f498e8340 100755
--- a/templates/repo/cloudbrain/benchmark/new.tmpl
+++ b/templates/repo/cloudbrain/benchmark/new.tmpl
@@ -83,7 +83,7 @@
-
+
@@ -102,11 +102,16 @@
+
@@ -182,12 +187,17 @@
function setChildType(){
let type_id = $('#benchmark_types_id').val();
+ let child_selected_id = $('#benchmark_child_types_id_hidden').val();
$.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => {
console.log(JSON.stringify(data))
const n_length = data['child_types'].length
let html=''
for (let i=0;i${data['child_types'][i].value}`;
+ if(child_selected_id == data['child_types'][i].id){
+ html += ``;
+ }else{
+ html += ``;
+ }
}
document.getElementById("benchmark_child_types_id").innerHTML=html;
})
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 8c2715613c..9724de2697 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -124,7 +124,7 @@
{{else if eq .GetOpType 27}}
{{else if eq .GetOpType 28}}
-
+
{{else if eq .GetOpType 29}}
{{else if eq .GetOpType 30}}
--
2.34.1
From 13f1ab8725ebcf041437b02362d767fdd7e670cf Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 16:35:50 +0800
Subject: [PATCH 11/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=87=BA=E9=94=99=E6=97=B6=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
routers/repo/cloudbrain.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 88fea0d8f7..a330c75726 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -1098,6 +1098,9 @@ func GetChildTypes(ctx *context.Context) {
}
func CloudBrainBenchmarkNew(ctx *context.Context) {
+ ctx.Data["description"] = ""
+ ctx.Data["benchmarkTypeID"] = ""
+ ctx.Data["benchmark_child_types_id_hidden"] = ""
err := cloudBrainNewDataPrepare(ctx)
if err != nil {
ctx.ServerError("get new cloudbrain info failed", err)
--
2.34.1
From fc560c8680358a56b11285f4c8436c78e9e9f094 Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 16:46:50 +0800
Subject: [PATCH 12/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=87=BA=E9=94=99=E6=97=B6=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
templates/repo/cloudbrain/benchmark/new.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl
index 6f498e8340..a8f60c86ff 100755
--- a/templates/repo/cloudbrain/benchmark/new.tmpl
+++ b/templates/repo/cloudbrain/benchmark/new.tmpl
@@ -102,7 +102,7 @@
-
+
--
2.34.1
From dcd509ada3d6aa95a31acb07e7d0a9b2bdb9c144 Mon Sep 17 00:00:00 2001
From: zouap
Date: Thu, 17 Feb 2022 17:33:29 +0800
Subject: [PATCH 15/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=87=BA=E9=94=99=E6=97=B6=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
public/home/home.js | 4 ++--
templates/user/dashboard/feeds.tmpl | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/public/home/home.js b/public/home/home.js
index 55736f6862..8fb64b6111 100644
--- a/public/home/home.js
+++ b/public/home/home.js
@@ -152,7 +152,7 @@ function getTaskLink(record){
if(record.OpType == 24){
return re + "/datasets?type=" + record.Content;
}else if(record.OpType == 25){
- return re + "/cloudbrain/" + record.Content;
+ return re + "/cloudbrain/" + record.RefName;
}else if(record.OpType == 26){
return re + "/modelarts/notebook/" + record.Content;
}else if(record.OpType == 27){
@@ -160,7 +160,7 @@ function getTaskLink(record){
}else if(record.OpType == 28){
return re + "/modelarts/inference-job/" + record.Content;
}else if(record.OpType == 29){
- return re + "/cloudbrain/benchmark/" + record.Content;
+ return re + "/cloudbrain/benchmark/" + record.RefName;
}else if(record.OpType == 30){
return re + "/modelmanage/show_model_info?name=" + record.RefName;
}
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 9724de2697..519dcda8f0 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -73,7 +73,7 @@
{{else if eq .GetOpType 24}}
{{$.i18n.Tr "action.upload_dataset" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 25}}
- {{$.i18n.Tr "action.task_gpudebugjob" .GetRepoLink .Content .RefName | Str2html}}
+ {{$.i18n.Tr "action.task_gpudebugjob" .GetRepoLink .RefName .RefName | Str2html}}
{{else if eq .GetOpType 26}}
{{$.i18n.Tr "action.task_npudebugjob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 27}}
@@ -81,7 +81,7 @@
{{else if eq .GetOpType 28}}
{{$.i18n.Tr "action.task_inferencejob" .GetRepoLink .Content .RefName | Str2html}}
{{else if eq .GetOpType 29}}
- {{$.i18n.Tr "action.task_benchmark" .GetRepoLink .Content .RefName | Str2html}}
+ {{$.i18n.Tr "action.task_benchmark" .GetRepoLink .RefName .RefName | Str2html}}
{{else if eq .GetOpType 30}}
{{$.i18n.Tr "action.task_createmodel" .GetRepoLink .RefName .RefName | Str2html}}
{{end}}
--
2.34.1
From 697f16f4a8d0af96e1b40a46c356e66633b37212 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 09:59:49 +0800
Subject: [PATCH 16/24] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E8=AF=A6=E6=83=85=E6=9F=A5=E7=9C=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
templates/repo/cloudbrain/benchmark/index.tmpl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/repo/cloudbrain/benchmark/index.tmpl b/templates/repo/cloudbrain/benchmark/index.tmpl
index ef81199fef..0da3173f20 100644
--- a/templates/repo/cloudbrain/benchmark/index.tmpl
+++ b/templates/repo/cloudbrain/benchmark/index.tmpl
@@ -99,8 +99,8 @@
--
2.34.1
From 03107e36e9a94efef5b7db0b3d85c4a25711dd7e Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 10:30:15 +0800
Subject: [PATCH 17/24] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E8=AF=A6=E6=83=85=E6=9F=A5=E7=9C=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
routers/repo/cloudbrain.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 11257de9ef..daf8c277e3 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -369,6 +369,8 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
ctx.Data["resource_spec"] = spec
taskRoles := jobRes.TaskRoles
if jobRes.JobStatus.State != string(models.JobFailed) {
+ accuracyJson, _ := json.Marshal(taskRoles)
+ log.Info("taskRoles=" + string(accuracyJson))
taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{}))
ctx.Data["taskRes"] = taskRes
task.Status = taskRes.TaskStatuses[0].State
--
2.34.1
From 00da2c7bac85af4338bd1d4eee9cbbef06394cb2 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 10:33:01 +0800
Subject: [PATCH 18/24] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E8=AF=A6=E6=83=85=E6=9F=A5=E7=9C=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
routers/repo/cloudbrain.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index daf8c277e3..76c0b1b8a1 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -356,12 +356,13 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
if err != nil {
ctx.Data["error"] = err.Error()
}
-
+ log.Info("task.JobID=" + task.JobID)
result, err := cloudbrain.GetJob(task.JobID)
if err != nil {
ctx.Data["error"] = err.Error()
}
-
+ accuracyJson, _ := json.Marshal(result)
+ log.Info(" task result=" + string(accuracyJson))
if result != nil {
jobRes, _ := models.ConvertToJobResultPayload(result.Payload)
jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB")
@@ -369,8 +370,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
ctx.Data["resource_spec"] = spec
taskRoles := jobRes.TaskRoles
if jobRes.JobStatus.State != string(models.JobFailed) {
- accuracyJson, _ := json.Marshal(taskRoles)
- log.Info("taskRoles=" + string(accuracyJson))
+
taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{}))
ctx.Data["taskRes"] = taskRes
task.Status = taskRes.TaskStatuses[0].State
--
2.34.1
From f3b8e988254a718b9156aba480f2c668686f495f Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 10:40:23 +0800
Subject: [PATCH 19/24] =?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/routes/routes.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index de355352f2..8a5508ae23 100755
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -992,7 +992,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/benchmark", func() {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchmarkIndex)
- m.Group("/:jobid", func() {
+ m.Group("/:jobname", func() {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchMarkShow)
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.BenchmarkDel)
--
2.34.1
From 8e5223c80ef0623e78e8b187e4fb645ada1ff5c7 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 10:47:10 +0800
Subject: [PATCH 20/24] =?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/cloudbrain.go | 4 ----
routers/routes/routes.go | 2 ++
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 76c0b1b8a1..fdaa60517f 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -350,19 +350,15 @@ func CloudBrainShow(ctx *context.Context) {
func cloudBrainShow(ctx *context.Context, tpName base.TplName) {
ctx.Data["PageIsCloudBrain"] = true
-
var jobName = ctx.Params(":jobname")
task, err := models.GetCloudbrainByName(jobName)
if err != nil {
ctx.Data["error"] = err.Error()
}
- log.Info("task.JobID=" + task.JobID)
result, err := cloudbrain.GetJob(task.JobID)
if err != nil {
ctx.Data["error"] = err.Error()
}
- accuracyJson, _ := json.Marshal(result)
- log.Info(" task result=" + string(accuracyJson))
if result != nil {
jobRes, _ := models.ConvertToJobResultPayload(result.Payload)
jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB")
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 8a5508ae23..8f678121ae 100755
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -994,6 +994,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchmarkIndex)
m.Group("/:jobname", func() {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchMarkShow)
+ })
+ m.Group("/:jobid", func() {
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.BenchmarkDel)
m.Get("/rate", reqRepoCloudBrainReader, repo.GetRate)
--
2.34.1
From ba0e91133bc80ed573508e31c4f52a67e13e3181 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 11:07:19 +0800
Subject: [PATCH 21/24] =?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/cloudbrain/benchmark/show.tmpl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl
index 99fd35de25..1919c785c4 100755
--- a/templates/repo/cloudbrain/benchmark/show.tmpl
+++ b/templates/repo/cloudbrain/benchmark/show.tmpl
@@ -188,6 +188,7 @@ td, th {
{{range $k ,$v := .version_list_task}}
+
@@ -438,7 +439,7 @@ td, th {
let urlArr = url.split('/')
userName = urlArr.slice(-5)[0]
repoPath = urlArr.slice(-4)[0]
- jobID = urlArr.slice(-1)[0]
+ jobID = document.getElementById("jobId_input").value
})
--
2.34.1
From 868cb685c2374fd1256698604d0e7cbf22c13317 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 11:16:44 +0800
Subject: [PATCH 22/24] =?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/cloudbrain/benchmark/show.tmpl | 1 +
1 file changed, 1 insertion(+)
diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl
index 1919c785c4..6b3e76e2ac 100755
--- a/templates/repo/cloudbrain/benchmark/show.tmpl
+++ b/templates/repo/cloudbrain/benchmark/show.tmpl
@@ -449,6 +449,7 @@ td, th {
$('input[name=end_line]').val(data.EndLine)
$('input[name=start_line]').val(data.StartLine)
$(`#log_file${version_name}`).text(data.Content)
+ console.log("cotent=" + data.Content)
document.getElementById("mask").style.display = "none"
}).fail(function(err) {
console.log(err);
--
2.34.1
From c2ea54c5e9c960f771d3f6098340208fe9aea015 Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 17:10:05 +0800
Subject: [PATCH 23/24] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B3=A8=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
modules/notification/notification.go | 3 ---
1 file changed, 3 deletions(-)
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index 92b108e3bc..0fd6fa4719 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -6,7 +6,6 @@ package notification
import (
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification/action"
"code.gitea.io/gitea/modules/notification/base"
"code.gitea.io/gitea/modules/notification/indexer"
@@ -40,9 +39,7 @@ func NewContext() {
// NotifyUploadAttachment notifies attachment upload message to notifiers
func NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
- log.Info("send attachment to db.")
for _, notifier := range notifiers {
- log.Info("send attachment to notifiers.")
notifier.NotifyOtherTask(doer, repo, id, name, optype)
}
}
--
2.34.1
From 46bc404f7987547e34ee1632eb7568da7eb93ecb Mon Sep 17 00:00:00 2001
From: zouap
Date: Fri, 18 Feb 2022 17:11:14 +0800
Subject: [PATCH 24/24] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B3=A8=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zouap
---
templates/repo/cloudbrain/benchmark/show.tmpl | 1 -
1 file changed, 1 deletion(-)
diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl
index 3bcc06890b..cf18c4b8c8 100755
--- a/templates/repo/cloudbrain/benchmark/show.tmpl
+++ b/templates/repo/cloudbrain/benchmark/show.tmpl
@@ -448,7 +448,6 @@ td, th {
$('input[name=end_line]').val(data.EndLine)
$('input[name=start_line]').val(data.StartLine)
$(`#log_file${version_name}`).text(data.Content)
- console.log("cotent=" + data.Content)
document.getElementById("mask").style.display = "none"
}).fail(function(err) {
console.log(err);
--
2.34.1