Skip to content

Commit

Permalink
Merge pull request kubernetes#85526 from hex108/dump_nominated_pods
Browse files Browse the repository at this point in the history
Print nominated pods when dumping scheduler cached NodeInfo
  • Loading branch information
k8s-ci-robot authored Nov 27, 2019
2 parents ab0bfb3 + abc64a8 commit be65a9d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/scheduler/internal/cache/debugger/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (d *CacheDumper) dumpNodes() {
snapshot := d.cache.Snapshot()
klog.Info("Dump of cached NodeInfo")
for _, nodeInfo := range snapshot.Nodes {
klog.Info(printNodeInfo(nodeInfo))
klog.Info(d.printNodeInfo(nodeInfo))
}
}

Expand All @@ -61,14 +61,22 @@ func (d *CacheDumper) dumpSchedulingQueue() {
}

// printNodeInfo writes parts of NodeInfo to a string.
func printNodeInfo(n *schedulernodeinfo.NodeInfo) string {
func (d *CacheDumper) printNodeInfo(n *schedulernodeinfo.NodeInfo) string {
var nodeData strings.Builder
nodeData.WriteString(fmt.Sprintf("\nNode name: %+v\nRequested Resources: %+v\nAllocatable Resources:%+v\nNumber of Pods: %v\nPods:\n",
nodeData.WriteString(fmt.Sprintf("\nNode name: %+v\nRequested Resources: %+v\nAllocatable Resources:%+v\nScheduled Pods(number: %v):\n",
n.Node().Name, n.RequestedResource(), n.AllocatableResource(), len(n.Pods())))
// Dumping Pod Info
for _, p := range n.Pods() {
nodeData.WriteString(printPod(p))
}
// Dumping nominated pods info on the node
nominatedPods := d.podQueue.NominatedPodsForNode(n.Node().Name)
if len(nominatedPods) != 0 {
nodeData.WriteString(fmt.Sprintf("Nominated Pods(number: %v):\n", len(nominatedPods)))
for _, p := range nominatedPods {
nodeData.WriteString(printPod(p))
}
}
return nodeData.String()
}

Expand Down

0 comments on commit be65a9d

Please sign in to comment.