Skip to content

Commit 7fd141c

Browse files
authored
adds New functions to the scorers for consistency (#975)
* adds New functions to the scorers for consistency Signed-off-by: Nir Rozenbaum <[email protected]> * update main to use the scorer new functions Signed-off-by: Nir Rozenbaum <[email protected]> --------- Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent 0e809d8 commit 7fd141c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cmd/epp/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ func (r *Runner) initializeScheduler(datastore datastore.Datastore) (*scheduling
272272
kvCacheScorerWeight := envutil.GetEnvInt("KV_CACHE_SCORE_WEIGHT", scorer.DefaultKVCacheScorerWeight, setupLog)
273273

274274
schedulerProfile := framework.NewSchedulerProfile().
275-
WithScorers(framework.NewWeightedScorer(&scorer.QueueScorer{}, queueScorerWeight),
276-
framework.NewWeightedScorer(&scorer.KVCacheScorer{}, kvCacheScorerWeight)).
275+
WithScorers(framework.NewWeightedScorer(scorer.NewQueueScorer(), queueScorerWeight),
276+
framework.NewWeightedScorer(scorer.NewKVCacheScorer(), kvCacheScorerWeight)).
277277
WithPicker(picker.NewMaxScorePicker())
278278

279279
if prefixCacheScheduling {

pkg/epp/scheduling/framework/plugins/scorer/kvcache.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const (
3030
// compile-time type assertion
3131
var _ framework.Scorer = &KVCacheScorer{}
3232

33+
// NewKVCacheScorer initializes a new KVCacheScorer and returns its pointer.
34+
func NewKVCacheScorer() *KVCacheScorer {
35+
return &KVCacheScorer{}
36+
}
37+
3338
// KVCacheScorer scores list of candidate pods based on KV cache utilization.
3439
type KVCacheScorer struct{}
3540

pkg/epp/scheduling/framework/plugins/scorer/queue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ const (
3131
// compile-time type assertion
3232
var _ framework.Scorer = &QueueScorer{}
3333

34+
// NewQueueScorer initializes a new QueueScorer and returns its pointer.
35+
func NewQueueScorer() *QueueScorer {
36+
return &QueueScorer{}
37+
}
38+
3439
// QueueScorer scores list of candidate pods based on the pod's waiting queue size.
3540
// the less waiting queue size the pod has, the higher score it will get (since it's more available to serve new request).
3641
type QueueScorer struct{}

0 commit comments

Comments
 (0)