Merge pull request #72632 from danielqsj/sch_pod

Move getNextPod to closure
This commit is contained in:
Kubernetes Prow Robot
2019-01-08 19:22:19 -08:00
committed by GitHub
2 changed files with 15 additions and 13 deletions

View File

@@ -811,3 +811,17 @@ func newNominatedPodMap() *nominatedPodMap {
nominatedPodToNode: make(map[ktypes.UID]string),
}
}
// MakeNextPodFunc returns a function to retrieve the next pod from a given
// scheduling queue
func MakeNextPodFunc(queue SchedulingQueue) func() *v1.Pod {
return func() *v1.Pod {
pod, err := queue.Pop()
if err == nil {
klog.V(4).Infof("About to try and schedule pod %v/%v", pod.Namespace, pod.Name)
return pod
}
klog.Errorf("Error while retrieving next pod from scheduling queue: %v", err)
return nil
}
}