We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2320018 commit d36498eCopy full SHA for d36498e
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go
@@ -120,7 +120,7 @@ func GetIndexAndTypeFromUUID(uuid string) (string, int) {
120
121
func GetMigUUIDFromSmiOutput(output string, uuid string, idx int) string {
122
migmode := false
123
- for _, val := range strings.Split(output, "\n") {
+ for val := range strings.SplitSeq(output, "\n") {
124
if !strings.Contains(val, "MIG") && strings.Contains(val, uuid) {
125
migmode = true
126
continue
pkg/device-plugin/nvidiadevice/nvinternal/rm/health.go
@@ -226,7 +226,7 @@ func getAdditionalXids(input string) []uint64 {
226
}
227
228
var additionalXids []uint64
229
- for _, additionalXid := range strings.Split(input, ",") {
+ for additionalXid := range strings.SplitSeq(input, ",") {
230
trimmed := strings.TrimSpace(additionalXid)
231
if trimmed == "" {
232
pkg/device/enflame/device.go
@@ -180,8 +180,7 @@ func (dev *EnflameDevices) checkUUID(annos map[string]string, d util.DeviceUsage
180
if ok {
181
klog.V(5).Infof("check uuid for Iluvatar user uuid [%s], device id is %s", userUUID, d.ID)
182
// use , symbol to connect multiple uuid
183
- userUUIDs := strings.Split(userUUID, ",")
184
- for _, uuid := range userUUIDs {
+ for uuid := range strings.SplitSeq(userUUID, ",") {
185
if d.ID == uuid {
186
return true
187
@@ -193,8 +192,7 @@ func (dev *EnflameDevices) checkUUID(annos map[string]string, d util.DeviceUsage
193
192
194
klog.V(5).Infof("check uuid for Iluvatar not user uuid [%s], device id is %s", noUserUUID, d.ID)
195
196
- noUserUUIDs := strings.Split(noUserUUID, ",")
197
- for _, uuid := range noUserUUIDs {
+ for uuid := range strings.SplitSeq(noUserUUID, ",") {
198
199
return false
200
pkg/device/hygon/device.go
@@ -95,7 +95,7 @@ func checkDCUtype(annos map[string]string, cardtype string) bool {
95
96
97
} else {
98
- for _, val := range strings.Split(inuse, ",") {
+ for val := range strings.SplitSeq(inuse, ",") {
99
if strings.Contains(strings.ToUpper(cardtype), strings.ToUpper(val)) {
100
101
@@ -109,7 +109,7 @@ func checkDCUtype(annos map[string]string, cardtype string) bool {
109
110
111
112
- for _, val := range strings.Split(nouse, ",") {
+ for val := range strings.SplitSeq(nouse, ",") {
113
114
115
pkg/device/kunlun/device.go
@@ -270,8 +270,7 @@ func parseInterconnection() [][]int {
270
271
func parseInterconnection2() [][]int {
272
var interconnection2 [][]int
273
- groups := strings.Split(InterGroupConnection2, ",")
274
- for _, group := range groups {
+ for group := range strings.SplitSeq(InterGroupConnection2, ",") {
275
values := strings.Split(group, "-")
276
connect := make([]int, 4)
277
for i, value := range values {
@@ -293,8 +292,7 @@ func interconnect(devices []*util.DeviceUsage, count int) []int {
293
292
if val2.Used > 0 || val2.Index == val.Index {
294
295
296
- pairs := strings.Split(InterGroupConnection, ",")
297
- for _, p := range pairs {
+ for p := range strings.SplitSeq(InterGroupConnection, ",") {
298
lw, _ := strconv.Atoi(strings.Split(p, "-")[0])
299
rw, _ := strconv.Atoi(strings.Split(p, "-")[1])
300
klog.V(5).InfoS("interconnect", "lw", lw, "rw", rw, "left device", val.Index, "right device", val2.Index)
pkg/scheduler/score_test.go
@@ -3011,8 +3011,7 @@ func makeDevice(id string, numa int, Type string, used, count, totalmem, usedmem
3011
// This function parses the string and returns a map where the key is the reason and the value is the corresponding count.
3012
func convertReasonToMap(reason string) map[string]int {
3013
var reasonMap map[string]int
3014
- reasonSlice := strings.Split(reason, ", ")
3015
- for _, r := range reasonSlice {
+ for r := range strings.SplitSeq(reason, ", ") {
3016
parts := strings.SplitN(r, " ", 2)
3017
if len(parts) != 2 {
3018
pkg/util/util.go
@@ -333,7 +333,7 @@ func DecodePodDevices(checklist map[string]string, annos map[string]string) (Pod
333
334
335
pd[devID] = make(PodSingleDevice, 0)
336
- for _, s := range strings.Split(str, OnePodMultiContainerSplitSymbol) {
+ for s := range strings.SplitSeq(str, OnePodMultiContainerSplitSymbol) {
337
cd, err := DecodeContainerDevices(s)
338
if err != nil {
339
return PodDevices{}, nil
0 commit comments