Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 57c119d

Browse files
committed
Remove KVcache scorer changes for traceability
Signed-off-by: Ricardo Noriega <[email protected]>
1 parent f3c00aa commit 57c119d

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

pkg/epp/scheduling/plugins/scorer/kvcache-aware-scorer.go

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,7 @@ func (s *KVCacheAwareScorer) Score(ctx *types.SchedulingContext, pods []types.Po
9797
}
9898
loggerDebug.Info("Got pod scores", "scores", scores)
9999

100-
if len(scores) == 0 {
101-
loggerDebug.Info("No scores found for pods")
102-
return nil
103-
}
104-
105-
podToKey := func(pod types.Pod) (string, bool) {
106-
metricsPod := pod.GetPod()
107-
if metricsPod == nil {
108-
return "", false
109-
}
110-
return metricsPod.Address, true
111-
}
112-
113-
return indexedScoresToNormalizedScoredPods(pods, podToKey, scores)
100+
return indexerScoresToNormalizedScoredPods(pods, scores)
114101
}
115102

116103
func getMinMax(scores map[string]int) (int, int) {
@@ -129,21 +116,17 @@ func getMinMax(scores map[string]int) (int, int) {
129116
return minScore, maxScore
130117
}
131118

132-
// podToKey is a function type that converts a Pod to a string key.
133-
// It returns the key and a boolean indicating success.
134-
type podToKeyFunc func(pod types.Pod) (string, bool)
135-
136-
func indexedScoresToNormalizedScoredPods(pods []types.Pod, podToKey podToKeyFunc, scores map[string]int) map[types.Pod]float64 {
119+
func indexerScoresToNormalizedScoredPods(pods []types.Pod, scores map[string]int) map[types.Pod]float64 {
137120
scoredPods := make(map[types.Pod]float64)
138121
minScore, maxScore := getMinMax(scores)
139122

140123
for _, pod := range pods {
141-
key, ok := podToKey(pod)
142-
if !ok {
124+
metricsPod := pod.GetPod()
125+
if metricsPod == nil {
143126
continue
144127
}
145128

146-
if score, ok := scores[key]; ok {
129+
if score, ok := scores[metricsPod.Address]; ok {
147130
if minScore == maxScore {
148131
scoredPods[pod] = 1.0
149132
continue

0 commit comments

Comments
 (0)