You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScheduleHpc.go 1.2 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package kq
  2. import (
  3. "context"
  4. "encoding/json"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  7. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  8. "gitlink.org.cn/jcce-pcm/pcm-coordinator/model"
  9. "gitlink.org.cn/jcce-pcm/utils/tool"
  10. )
  11. /*
  12. *
  13. Listening to the payment flow status change notification message queue
  14. */
  15. type ScheduleHpcMq struct {
  16. ctx context.Context
  17. svcCtx *svc.ServiceContext
  18. }
  19. func NewScheduleHpcMq(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleHpcMq {
  20. return &ScheduleHpcMq{
  21. ctx: ctx,
  22. svcCtx: svcCtx,
  23. }
  24. }
  25. func (l *ScheduleHpcMq) Consume(_, val string) error {
  26. // 接受消息
  27. var task *types.TaskInfo
  28. json.Unmarshal([]byte(val), &task)
  29. //if len(task.MatchLabels) != 0 {
  30. // participantId, err := scheduler.MatchLabels(l.svcCtx.DbEngin, task)
  31. // if err != nil {
  32. // return err
  33. // }
  34. //}
  35. hpc := model.Hpc{
  36. TaskId: task.TaskId,
  37. Status: "Saved",
  38. //ParticipantId: participantId[0],
  39. YamlString: val,
  40. }
  41. tool.Convert(task.Metadata, &hpc)
  42. // 存储数据
  43. tx := l.svcCtx.DbEngin.Create(&hpc)
  44. if tx.Error != nil {
  45. logx.Error(tx.Error)
  46. return tx.Error
  47. }
  48. return nil
  49. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.