File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 99
1010 log "github.com/golang/glog"
1111 "k8s.io/api/core/v1"
12+ "k8s.io/apimachinery/pkg/types"
1213)
1314
1415func displayDetails (nodeInfos []* NodeInfo ) {
@@ -55,24 +56,33 @@ func displayDetails(nodeInfos []*NodeInfo) {
5556 fmt .Fprintf (w , buf .String ())
5657
5758 var buffer bytes.Buffer
59+ exists := map [types.UID ]bool {}
5860 for i , dev := range nodeInfo .devs {
5961 usedGPUMemInNode += dev .usedGPUMem
6062 for _ , pod := range dev .pods {
61-
63+ if _ ,ok := exists [pod .UID ]; ok {
64+ continue
65+ }
6266 buffer .WriteString (fmt .Sprintf ("%s\t %s\t " , pod .Name , pod .Namespace ))
6367 count := nodeInfo .gpuCount
6468 if nodeInfo .hasPendingGPUMemory () {
6569 count += 1
6670 }
6771
6872 for k := 0 ; k < count ; k ++ {
73+ allocation := GetAllocation (& pod )
74+ if len (allocation ) != 0 {
75+ buffer .WriteString (fmt .Sprintf ("%d\t " , allocation [k ]))
76+ continue
77+ }
6978 if k == i || (i == - 1 && k == nodeInfo .gpuCount ) {
7079 buffer .WriteString (fmt .Sprintf ("%d\t " , getGPUMemoryInPod (pod )))
7180 } else {
7281 buffer .WriteString ("0\t " )
7382 }
7483 }
7584 buffer .WriteString ("\n " )
85+ exists [pod .UID ] = true
7686 }
7787 }
7888 if prtLineLen == 0 {
You can’t perform that action at this time.
0 commit comments