Skip to content

Commit

Permalink
Distinguish between Preemption due to reclamation and fair sharing
Browse files Browse the repository at this point in the history
* Use slice in getWorkloadReferences
  • Loading branch information
vladikkuzn committed Jul 10, 2024
1 parent 7327a1e commit f62b1bb
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkg/scheduler/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"sigs.k8s.io/kueue/pkg/cache"
"sigs.k8s.io/kueue/pkg/scheduler/preemption"
"sigs.k8s.io/kueue/pkg/util/slices"
)

func logAdmissionAttemptIfVerbose(log logr.Logger, e *entry) {
Expand Down Expand Up @@ -49,12 +50,5 @@ func logSnapshotIfVerbose(log logr.Logger, s *cache.Snapshot) {
}

func getWorkloadReferences(targets []*preemption.Target) []klog.ObjectRef {
if len(targets) == 0 {
return nil
}
keys := make([]klog.ObjectRef, len(targets))
for i, t := range targets {
keys[i] = klog.KObj(t.WorkloadInfo.Obj)
}
return keys
return slices.Map(targets, func(t **preemption.Target) klog.ObjectRef { return klog.KObj((*t).WorkloadInfo.Obj) })
}

0 comments on commit f62b1bb

Please sign in to comment.