Skip to content
Permalink
Browse files

Print nominated pods on the node when dumping scheduler cached NodeInfo

  • Loading branch information
hex108 committed Nov 22, 2019
1 parent d87c921 commit abc64a8519c5def9423d520657d4f91cc8cb10ce
Showing with 11 additions and 3 deletions.
  1. +11 −3 pkg/scheduler/internal/cache/debugger/dumper.go
@@ -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))
}
}

@@ -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()
}

0 comments on commit abc64a8

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