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.

gethpcappclusterlogic.go 1.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package hpc
  2. import (
  3. "context"
  4. "github.com/rs/zerolog/log"
  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 GetHpcAppClusterLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetHpcAppClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHpcAppClusterLogic {
  15. return &GetHpcAppClusterLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. type ClusterInfo struct {
  22. Id string `json:"id"`
  23. Name string `json:"name"`
  24. }
  25. func (l *GetHpcAppClusterLogic) GetHpcAppCluster(req *types.HpcAppClusterReq) (resp *types.ListResult, err error) {
  26. resp = &types.ListResult{}
  27. var clusterIds []string
  28. err = l.svcCtx.DbEngin.Table("hpc_app_template").Distinct("cluster_id").
  29. Where(" app = ? and status = 1 and deleted_at is null", req.App).
  30. Find(&clusterIds).Error
  31. if err != nil {
  32. log.Error().Msgf("获取HPC应用集群失败: %v", err)
  33. return nil, err
  34. }
  35. var listCluster []ClusterInfo
  36. err = l.svcCtx.DbEngin.Table("t_cluster").Where("id in (?)", clusterIds).Scan(&listCluster).Error
  37. if err != nil {
  38. log.Error().Msgf("获取集群信息失败: %v", err)
  39. return nil, err
  40. }
  41. resp.List = listCluster
  42. return
  43. }

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.