diff --git a/pkg/controller/queuejobresources/utils.go b/pkg/controller/queuejobresources/utils.go index 1b78cc1a7..7653388b0 100644 --- a/pkg/controller/queuejobresources/utils.go +++ b/pkg/controller/queuejobresources/utils.go @@ -61,6 +61,10 @@ func PendingPodsFailedSchd(pods []*v1.Pod) map[string][]v1.PodCondition { if strings.Contains(cond.Message, "pgName") && strings.Contains(cond.Message, "last") && strings.Contains(cond.Message, "failed") && strings.Contains(cond.Message, "deny") { //ignore co-scheduled pending pods for coscheduler version:0.22.6 continue + } else if strings.Contains(cond.Message, "optimistic") && strings.Contains(cond.Message, "rejection") && strings.Contains(cond.Message, "PostFilter") || + strings.Contains(cond.Message, "cannot") && strings.Contains(cond.Message, "find") && strings.Contains(cond.Message, "enough") && strings.Contains(cond.Message, "sibling") { + //ignore co-scheduled pending pods for coscheduler version:0.23.10 + continue } else { podName := string(pods[i].Name) podCondition[podName] = append(podCondition[podName], *cond.DeepCopy()) @@ -74,41 +78,41 @@ func PendingPodsFailedSchd(pods []*v1.Pod) map[string][]v1.PodCondition { // filterPods returns pods based on their phase. func GetPodResourcesByPhase(phase v1.PodPhase, pods []*v1.Pod) *clusterstateapi.Resource { - req := clusterstateapi.EmptyResource() - for i := range pods { - if pods[i].Status.Phase == phase { - for _, c := range pods[i].Spec.Containers { - req.Add(clusterstateapi.NewResource(c.Resources.Requests)) - } - } - } - return req + req := clusterstateapi.EmptyResource() + for i := range pods { + if pods[i].Status.Phase == phase { + for _, c := range pods[i].Spec.Containers { + req.Add(clusterstateapi.NewResource(c.Resources.Requests)) + } + } + } + return req } func GetPodResources(template *v1.PodTemplateSpec) *clusterstateapi.Resource { - total := clusterstateapi.EmptyResource() - req := clusterstateapi.EmptyResource() - limit := clusterstateapi.EmptyResource() - spec := template.Spec + total := clusterstateapi.EmptyResource() + req := clusterstateapi.EmptyResource() + limit := clusterstateapi.EmptyResource() + spec := template.Spec - if &spec == nil { - klog.Errorf("Pod Spec not found in Pod Template: %+v. Aggregated resources set to 0.", template) - return total - } + if &spec == nil { + klog.Errorf("Pod Spec not found in Pod Template: %+v. Aggregated resources set to 0.", template) + return total + } - for _, c := range template.Spec.Containers { - req.Add(clusterstateapi.NewResource(c.Resources.Requests)) - limit.Add(clusterstateapi.NewResource(c.Resources.Limits)) - } - if req.MilliCPU < limit.MilliCPU { - req.MilliCPU = limit.MilliCPU - } - if req.Memory < limit.Memory { - req.Memory = limit.Memory - } - if req.GPU < limit.GPU { - req.GPU = limit.GPU - } - total = total.Add(req) - return total + for _, c := range template.Spec.Containers { + req.Add(clusterstateapi.NewResource(c.Resources.Requests)) + limit.Add(clusterstateapi.NewResource(c.Resources.Limits)) + } + if req.MilliCPU < limit.MilliCPU { + req.MilliCPU = limit.MilliCPU + } + if req.Memory < limit.Memory { + req.Memory = limit.Memory + } + if req.GPU < limit.GPU { + req.GPU = limit.GPU + } + total = total.Add(req) + return total }