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 876 B

2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package mqs
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  5. scheduler2 "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/scheduler"
  6. )
  7. /*
  8. *
  9. Listening to the payment flow status change notification message queue
  10. */
  11. type HpcMq struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewHpcMq(ctx context.Context, svcCtx *svc.ServiceContext) *HpcMq {
  16. return &HpcMq{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *HpcMq) Consume(val string) error {
  22. // 接受消息, 根据标签筛选过滤
  23. hpcSchdl := scheduler2.NewHpcScheduler(val)
  24. schdl, err := scheduler2.NewScheduler(hpcSchdl, val, l.svcCtx.DbEngin)
  25. if err != nil {
  26. return err
  27. }
  28. schdl.MatchLabels()
  29. // 调度算法
  30. err = schdl.AssignAndSchedule()
  31. if err != nil {
  32. return err
  33. }
  34. // 存储数据
  35. err = schdl.SaveToDb()
  36. if err != nil {
  37. return err
  38. }
  39. return nil
  40. }

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.