diff --git a/models/action.go b/models/action.go
index 4821910db..2a9d88399 100755
--- a/models/action.go
+++ b/models/action.go
@@ -49,6 +49,14 @@ const (
ActionApprovePullRequest // 21
ActionRejectPullRequest // 22
ActionCommentPull // 23
+
+ 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 f15443b30..b86a2d3f4 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 301c4cb0e..5f8cac81c 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"
)
@@ -259,7 +260,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
}
@@ -335,12 +336,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,
@@ -371,7 +372,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
}
@@ -555,12 +556,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,
@@ -595,6 +596,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 4bc296657..babf4acf6 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -330,3 +330,18 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
log.Error("notifyWatchers: %v", err)
}
}
+
+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: optype,
+ RepoID: repo.ID,
+ Repo: repo,
+ IsPrivate: repo.IsPrivate,
+ 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 8325f710c..8d6fdeb52 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -54,4 +54,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)
+
+ NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType)
}
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index a74c47980..0d3489882 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -154,3 +154,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) 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 d12024663..0fd6fa471 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 NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
+ for _, notifier := range notifiers {
+ notifier.NotifyOtherTask(doer, repo, id, name, optype)
+ }
+}
+
// 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/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index f277ff8fc..1c9471cf7 100755
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2683,6 +2683,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`
+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 197481358..669c34cc1 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -2693,6 +2693,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`
+task_gpudebugjob=`创建了CPU/GPU类型调试任务 %s`
+task_npudebugjob=`创建了NPU类型调试任务 %s`
+task_trainjob=`创建了训练任务 %s`
+task_inferencejob=`创建了推理任务 %s`
+task_benchmark=`创建了评测任务 %s`
+task_createmodel=`导入了新模型 %s`
[tool]
ago=%s前
diff --git a/public/home/home.js b/public/home/home.js
index 7d5cbe4b1..8fb64b611 100644
--- a/public/home/home.js
+++ b/public/home/home.js
@@ -125,12 +125,15 @@ socket.onmessage = function (e) {
else if(record.OpType == "2"){
actionName = actionName.replace("{oldRepoName}",record.Content);
html += recordPrefix + actionName;
- html += " " + getRepotext(record) + ""
+ 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;
@@ -138,13 +141,32 @@ socket.onmessage = function (e) {
html += "";
html += "";
}
-
}
output.innerHTML = html;
swiperNewMessage.updateSlides();
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.RefName;
+ }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.RefName;
+ }else if(record.OpType == 30){
+ return re + "/modelmanage/show_model_info?name=" + record.RefName;
+ }
+ return re;
+}
+
function getMsg(record){
var html ="";
html += "