Skip to content
Permalink
Browse files

add pod info when failing to add pod to queue

  • Loading branch information
cwdsuzhou committed Nov 19, 2019
1 parent 6ff3b68 commit 09f3c2ec83fc8e1cc67558c19f98241e308c3bcc
Showing with 8 additions and 8 deletions.
  1. +8 −8 pkg/scheduler/internal/queue/scheduling_queue.go
@@ -260,16 +260,16 @@ func (p *PriorityQueue) Add(pod *v1.Pod) error {
defer p.lock.Unlock()
pInfo := p.newPodInfo(pod)
if err := p.activeQ.Add(pInfo); err != nil {
klog.Errorf("Error adding pod %v/%v to the scheduling queue: %v", pod.Namespace, pod.Name, err)
klog.Errorf("Error adding pod %v to the scheduling queue: %v", nsNameForPod(pod), err)
return err
}
if p.unschedulableQ.get(pod) != nil {
klog.Errorf("Error: pod %v/%v is already in the unschedulable queue.", pod.Namespace, pod.Name)
klog.Errorf("Error: pod %v is already in the unschedulable queue.", nsNameForPod(pod))
p.unschedulableQ.delete(pod)
}
// Delete pod from backoffQ if it is backing off
if err := p.podBackoffQ.Delete(pInfo); err == nil {
klog.Errorf("Error: pod %v/%v is already in the podBackoff queue.", pod.Namespace, pod.Name)
klog.Errorf("Error: pod %v is already in the podBackoff queue.", nsNameForPod(pod))
}
metrics.SchedulerQueueIncomingPods.WithLabelValues("active", PodAdd).Inc()
p.nominatedPods.add(pod, "")
@@ -329,16 +329,16 @@ func (p *PriorityQueue) AddUnschedulableIfNotPresent(pInfo *framework.PodInfo, p
defer p.lock.Unlock()
pod := pInfo.Pod
if p.unschedulableQ.get(pod) != nil {
return fmt.Errorf("pod is already present in unschedulableQ")
return fmt.Errorf("pod: %v/%v is already present in unschedulable queue", pod.Namespace, pod.Name)
}

// Refresh the timestamp since the pod is re-added.
pInfo.Timestamp = p.clock.Now()
if _, exists, _ := p.activeQ.Get(pInfo); exists {
return fmt.Errorf("pod is already present in the activeQ")
return fmt.Errorf("pod: %v/%v is already present in the active queue", pod.Namespace, pod.Name)
}
if _, exists, _ := p.podBackoffQ.Get(pInfo); exists {
return fmt.Errorf("pod is already present in the backoffQ")
return fmt.Errorf("pod %v/%v is already present in the backoff queue", pod.Namespace, pod.Name)
}

// Every unschedulable pod is subject to backoff timers.
@@ -373,7 +373,7 @@ func (p *PriorityQueue) flushBackoffQCompleted() {
pod := rawPodInfo.(*framework.PodInfo).Pod
boTime, found := p.podBackoff.GetBackoffTime(nsNameForPod(pod))
if !found {
klog.Errorf("Unable to find backoff value for pod %v in backoffQ", nsNameForPod(pod))
klog.Errorf("Unable to find backoff value for pod %v in backoff queue", nsNameForPod(pod))
p.podBackoffQ.Pop()
p.activeQ.Add(rawPodInfo)
metrics.SchedulerQueueIncomingPods.WithLabelValues("active", BackoffComplete).Inc()
@@ -386,7 +386,7 @@ func (p *PriorityQueue) flushBackoffQCompleted() {
}
_, err := p.podBackoffQ.Pop()
if err != nil {
klog.Errorf("Unable to pop pod %v from backoffQ despite backoff completion.", nsNameForPod(pod))
klog.Errorf("Unable to pop pod %v from backoff queue despite backoff completion.", nsNameForPod(pod))
return
}
p.activeQ.Add(rawPodInfo)

0 comments on commit 09f3c2e

Please sign in to comment.
You can’t perform that action at this time.