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.

resourcelogic.go 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package hpc
  2. import (
  3. "context"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type ResourceLogic struct {
  9. logx.Logger
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. }
  13. func NewResourceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResourceLogic {
  14. return &ResourceLogic{
  15. Logger: logx.WithContext(ctx),
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. }
  19. }
  20. func (l *ResourceLogic) Resource(req *types.HpcResourceReq) (resp *types.HpcResourceResp, err error) {
  21. l.svcCtx.DbEngin.Raw("SELECT th.NAME as job_name,t.description as job_desc,t.commit_time as submit_time,th.STATUS as job_status,ta.name as adapter_name,tc.name as cluster_name,tc.label as cluster_type FROM task_hpc th LEFT JOIN task t ON t.id = th.task_id JOIN t_cluster tc on th.cluster_id = tc.id JOIN t_adapter ta on tc.adapter_id = ta.id")
  22. hpcResource := types.HPCResource{
  23. GPUCardsTotal: 0,
  24. CPUCoresTotal: 0,
  25. RAMTotal: 0,
  26. GPUCardsUsed: 0,
  27. CPUCoresUsed: 0,
  28. RAMUsed: 0,
  29. GPURate: 0,
  30. CPURate: 0,
  31. RAMRate: 0,
  32. }
  33. resp = &types.HpcResourceResp{
  34. Code: 200,
  35. Msg: "success",
  36. HPCResource: hpcResource,
  37. }
  38. return resp, nil
  39. }

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.