Skip to content

Commit 1aca6f7

Browse files
committed
add constants for parts of environment variables names + make sure that all GIE scorer env vars names consistant
Signed-off-by: Maya Barnea <mayab@il.ibm.com>
1 parent 55c58aa commit 1aca6f7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

pkg/config/config.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const (
2525
// SessionAwareScorerName name of the session aware scorer in configuration
2626
SessionAwareScorerName = "SESSION_AWARE_SCORER"
2727

28+
prefillPrefix = "PREFILL_"
29+
enablePrefix = "ENABLE_"
30+
weightSuffix = "_WEIGHT"
31+
2832
// Plugins from Upstream
2933

3034
// GIELeastKVCacheFilterName name of the GIE least kv-cache filter in configuration
@@ -41,8 +45,8 @@ const (
4145
GIEKVCacheUtilizationScorerName = "GIE_KVCACHE_UTILIZATION_SCORER"
4246
// GIEQueueScorerName name of the GIE queue scorer in configuration
4347
GIEQueueScorerName = "GIE_QUEUE_SCORER"
44-
// K8SPrefixScorerName name of the GIE prefix plugin in configuration
45-
K8SPrefixScorerName = "GIE_PREFIX_SCORER"
48+
// GIEPrefixScorerName name of the GIE prefix plugin in configuration
49+
GIEPrefixScorerName = "GIE_PREFIX_SCORER"
4650

4751
pdEnabledEnvKey = "PD_ENABLED"
4852
pdPromptLenThresholdEnvKey = "PD_PROMPT_LEN_THRESHOLD"
@@ -81,13 +85,13 @@ func (c *Config) LoadConfig() {
8185
KVCacheScorerName, LoadAwareScorerName, PrefixScorerName, SessionAwareScorerName,
8286
GIELeastKVCacheFilterName, GIELeastQueueFilterName, GIELoraAffinityFilterName,
8387
GIELowQueueFilterName, GIESheddableCapacityFilterName,
84-
GIEKVCacheUtilizationScorerName, GIEQueueScorerName, K8SPrefixScorerName)
88+
GIEKVCacheUtilizationScorerName, GIEQueueScorerName, GIEPrefixScorerName)
8589

8690
c.loadPluginInfo(c.PrefillSchedulerPlugins, true,
8791
KVCacheScorerName, LoadAwareScorerName, PrefixScorerName, SessionAwareScorerName,
8892
GIELeastKVCacheFilterName, GIELeastQueueFilterName, GIELoraAffinityFilterName,
8993
GIELowQueueFilterName, GIESheddableCapacityFilterName,
90-
GIEKVCacheUtilizationScorerName, GIEQueueScorerName, K8SPrefixScorerName)
94+
GIEKVCacheUtilizationScorerName, GIEQueueScorerName, GIEPrefixScorerName)
9195

9296
c.PDEnabled = env.GetEnvString(pdEnabledEnvKey, "false", c.logger) == "true"
9397
c.PDThreshold = env.GetEnvInt(pdPromptLenThresholdEnvKey, pdPromptLenThresholdDefault, c.logger)
@@ -99,11 +103,11 @@ func (c *Config) loadPluginInfo(plugins map[string]int, prefill bool, pluginName
99103
var enablementKey string
100104
var weightKey string
101105
if prefill {
102-
enablementKey = "PREFILL_ENABLE_" + pluginName
103-
weightKey = "PREFILL_" + pluginName + "_WEIGHT"
106+
enablementKey = prefillPrefix + enablePrefix + pluginName
107+
weightKey = prefillPrefix + pluginName + weightSuffix
104108
} else {
105-
enablementKey = "ENABLE_" + pluginName
106-
weightKey = pluginName + "_WEIGHT"
109+
enablementKey = enablePrefix + pluginName
110+
weightKey = pluginName + weightSuffix
107111
}
108112

109113
if env.GetEnvString(enablementKey, "false", c.logger) != "true" {

pkg/scheduling/pd/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (s *Scheduler) pluginsFromConfig(ctx context.Context, pluginsConfig map[str
190190
plugins[k8sfilter.NewSheddableCapacityFilter()] = pluginWeight
191191
case config.GIEKVCacheUtilizationScorerName:
192192
plugins[&k8sscorer.KVCacheScorer{}] = pluginWeight
193-
case config.K8SPrefixScorerName:
193+
case config.GIEPrefixScorerName:
194194
// For now use the default configuration
195195
prefixConfig := prefix.Config{
196196
HashBlockSize: envutil.GetEnvInt("PREFIX_CACHE_HASH_BLOCK_SIZE", prefix.DefaultHashBlockSize, logger),

0 commit comments

Comments
 (0)