(infoResponse *schema.InfoResponse)
| 1084 | } |
| 1085 | |
| 1086 | func printInfoNodes(infoResponse *schema.InfoResponse) { |
| 1087 | numAPIInstances := len(infoResponse.WorkerNodeInfos) |
| 1088 | |
| 1089 | var totalReplicas int |
| 1090 | var doesClusterHaveGPUs, doesClusterHaveInfs, doesClusterHaveEnqueuers bool |
| 1091 | for _, nodeInfo := range infoResponse.WorkerNodeInfos { |
| 1092 | totalReplicas += nodeInfo.NumReplicas |
| 1093 | if nodeInfo.ComputeUserCapacity.GPU > 0 { |
| 1094 | doesClusterHaveGPUs = true |
| 1095 | } |
| 1096 | if nodeInfo.ComputeUserCapacity.Inf > 0 { |
| 1097 | doesClusterHaveInfs = true |
| 1098 | } |
| 1099 | if nodeInfo.NumEnqueuerReplicas > 0 { |
| 1100 | doesClusterHaveEnqueuers = true |
| 1101 | } |
| 1102 | } |
| 1103 | |
| 1104 | var pendingReplicasStr string |
| 1105 | if infoResponse.NumPendingReplicas > 0 { |
| 1106 | pendingReplicasStr = fmt.Sprintf(", and %d unscheduled %s", infoResponse.NumPendingReplicas, s.PluralS("replica", infoResponse.NumPendingReplicas)) |
| 1107 | } |
| 1108 | |
| 1109 | fmt.Printf(console.Bold("\nyour cluster has %d API %s running across %d %s%s\n"), totalReplicas, s.PluralS("replica", totalReplicas), numAPIInstances, s.PluralS("instance", numAPIInstances), pendingReplicasStr) |
| 1110 | |
| 1111 | if len(infoResponse.WorkerNodeInfos) == 0 { |
| 1112 | return |
| 1113 | } |
| 1114 | |
| 1115 | headers := []table.Header{ |
| 1116 | {Title: "instance type"}, |
| 1117 | {Title: "lifecycle"}, |
| 1118 | {Title: "replicas"}, |
| 1119 | {Title: "batch enqueuer replicas", Hidden: !doesClusterHaveEnqueuers}, |
| 1120 | {Title: "CPU (requested / total allocatable)"}, |
| 1121 | {Title: "memory (requested / total allocatable)"}, |
| 1122 | {Title: "GPU (requested / total allocatable)", Hidden: !doesClusterHaveGPUs}, |
| 1123 | {Title: "Inf (requested / total allocatable)", Hidden: !doesClusterHaveInfs}, |
| 1124 | } |
| 1125 | |
| 1126 | var rows [][]interface{} |
| 1127 | for _, nodeInfo := range infoResponse.WorkerNodeInfos { |
| 1128 | lifecycle := "on-demand" |
| 1129 | if nodeInfo.IsSpot { |
| 1130 | lifecycle = "spot" |
| 1131 | } |
| 1132 | |
| 1133 | cpuStr := nodeInfo.ComputeUserRequested.CPU.MilliString() + " / " + nodeInfo.ComputeUserCapacity.CPU.MilliString() |
| 1134 | memStr := nodeInfo.ComputeUserRequested.Mem.String() + " / " + nodeInfo.ComputeUserCapacity.Mem.String() |
| 1135 | gpuStr := s.Int64(nodeInfo.ComputeUserRequested.GPU) + " / " + s.Int64(nodeInfo.ComputeUserCapacity.GPU) |
| 1136 | infStr := s.Int64(nodeInfo.ComputeUserRequested.Inf) + " / " + s.Int64(nodeInfo.ComputeUserCapacity.Inf) |
| 1137 | rows = append(rows, []interface{}{nodeInfo.InstanceType, lifecycle, nodeInfo.NumReplicas, nodeInfo.NumEnqueuerReplicas, cpuStr, memStr, gpuStr, infStr}) |
| 1138 | } |
| 1139 | |
| 1140 | t := table.Table{ |
| 1141 | Headers: headers, |
| 1142 | Rows: rows, |
| 1143 | } |
no test coverage detected