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.

getcomputecardsbyclusterlogic.go 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package schedule
  2. import (
  3. "context"
  4. "errors"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetComputeCardsByClusterLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetComputeCardsByClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetComputeCardsByClusterLogic {
  15. return &GetComputeCardsByClusterLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *GetComputeCardsByClusterLogic) GetComputeCardsByCluster(req *types.GetComputeCardsByClusterReq) (resp *types.GetComputeCardsByClusterResp, err error) {
  22. resp = &types.GetComputeCardsByClusterResp{}
  23. adapter, ok := l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[req.AdapterId]
  24. if !ok {
  25. return nil, errors.New("adapterId does not exist")
  26. }
  27. cluster, ok := adapter[req.ClusterId]
  28. if !ok {
  29. return nil, errors.New("clusterId does not exist")
  30. }
  31. cards, err := cluster.GetComputeCards(l.ctx)
  32. if err != nil {
  33. return nil, err
  34. }
  35. resp.Cards = cards
  36. return resp, nil
  37. }

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.