push notice when new hpc job submitted
Former-commit-id: 459845bff6477ce1a0b43cba3eac68aa2c7d1223
This commit is contained in:
parent
4849b93853
commit
8d8d6a9822
|
@ -2,10 +2,12 @@ package hpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
"k8s.io/apimachinery/pkg/util/json"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
|
@ -88,6 +90,21 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return nil, tx.Error
|
return nil, tx.Error
|
||||||
}
|
}
|
||||||
|
adapterId, _ := strconv.ParseUint(req.AdapterId, 10, 64)
|
||||||
|
adapterName := ""
|
||||||
|
tx.Table("t_adapter").Select("name").Where("id=?", adapterId).Find(&adapterName)
|
||||||
|
noticeInfo := clientCore.NoticeInfo{
|
||||||
|
AdapterId: int64(adapterId),
|
||||||
|
AdapterName: adapterName,
|
||||||
|
NoticeType: "create",
|
||||||
|
TaskName: req.Name,
|
||||||
|
Incident: "任务创建中",
|
||||||
|
CreatedTime: time.Now(),
|
||||||
|
}
|
||||||
|
result := l.svcCtx.DbEngin.Table("t_notice").Create(¬iceInfo)
|
||||||
|
if result.Error != nil {
|
||||||
|
logx.Errorf("Task creation failure, err: %v", result.Error)
|
||||||
|
}
|
||||||
// todo mq task manage
|
// todo mq task manage
|
||||||
//reqMessage, err := json.Marshal(mqInfo)
|
//reqMessage, err := json.Marshal(mqInfo)
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue