Merge pull request 'push notice when new hpc job submitted' (#147) from zhouqunjie/pcm-coordinator:master into master
Former-commit-id: 05a76578395ec6afebbcd1aa61dabee4e8a9924a
This commit is contained in:
commit
4690d1fa5a
|
@ -2,10 +2,12 @@ package hpc
|
|||
|
||||
import (
|
||||
"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/models"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"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 {
|
||||
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
|
||||
//reqMessage, err := json.Marshal(mqInfo)
|
||||
//if err != nil {
|
||||
|
|
Loading…
Reference in New Issue