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.

loadPriority.go 996 B

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package strategy
  2. import (
  3. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/collector"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/storeLink"
  5. )
  6. type LoadPriority struct {
  7. Replicas int32
  8. Clusters []*CLusterLoad
  9. }
  10. type CLusterLoad struct {
  11. ClusterId string
  12. TaskRunningNum int64
  13. TaskPredictedNum int64
  14. }
  15. func NewLoadPriority(replicas int32, resources []*collector.ResourceSpec) *LoadPriority {
  16. var clusters []*CLusterLoad
  17. for _, resource := range resources {
  18. if resource.ClusterId == "" {
  19. continue
  20. }
  21. cluster := &CLusterLoad{
  22. ClusterId: resource.ClusterId,
  23. }
  24. for _, res := range resource.Resources {
  25. r, ok := res.(*collector.Usage)
  26. if !ok {
  27. continue
  28. }
  29. switch r.Type {
  30. case storeLink.RUNNINGTASK:
  31. num, ok := r.Total.Value.(int64)
  32. if !ok {
  33. continue
  34. }
  35. cluster.TaskRunningNum = num
  36. }
  37. }
  38. clusters = append(clusters, cluster)
  39. }
  40. return &LoadPriority{Replicas: replicas, Clusters: clusters}
  41. }

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.