Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/epp/scheduling/framework/plugins/multi/prefix/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func (p *Plugin) WithName(name string) *Plugin {

// Score returns the scoring result for the given list of pods based on context.
func (p *Plugin) Score(ctx context.Context, cycleState *types.CycleState, request *types.LLMRequest, pods []types.Pod) map[types.Pod]float64 {
loggerTrace := log.FromContext(ctx).V(logutil.TRACE)
// pre score step, hashing prompt and find longest prefix match.
hashes := hashPrompt(ctx, request, p.config.HashBlockSize, p.config.MaxPrefixBlocksToMatch)
state := &SchedulingContextState{
Expand All @@ -185,7 +184,7 @@ func (p *Plugin) Score(ctx context.Context, cycleState *types.CycleState, reques

cycleState.Write(plugins.StateKey(p.TypedName().String()), state)
p.pluginState.Write(request.RequestId, plugins.StateKey(p.TypedName().String()), state)
loggerTrace.Info(fmt.Sprintf("cached servers: %+v", state.PrefixCacheServers), "hashes", state.PrefixHashes)
log.FromContext(ctx).V(logutil.TRACE).Info("prefix cached state", "cached-servers", state.PrefixCacheServers, "hashes", state.PrefixHashes)
// calculate the scores of pods
scores := make(map[types.Pod]float64, len(pods))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func (p *MaxScorePicker) TypedName() plugins.TypedName {

// Pick selects the pod with the maximum score from the list of candidates.
func (p *MaxScorePicker) Pick(ctx context.Context, cycleState *types.CycleState, scoredPods []*types.ScoredPod) *types.ProfileRunResult {
log.FromContext(ctx).V(logutil.DEBUG).Info("Selecting pods from candidates sorted by max score: ", "NumberOfPods", p.maxNumOfEndpoints,
"scoredPodsLength", len(scoredPods), "scoredPods", scoredPods)
log.FromContext(ctx).V(logutil.DEBUG).Info("Selecting pods from candidates sorted by max score", "max-num-of-endpoints", p.maxNumOfEndpoints,
"num-of-candidates", len(scoredPods), "scored-pods", scoredPods)

// TODO: merge this with the logic in RandomPicker
// Rand package is not safe for concurrent use, so we create a new instance.
Expand Down
5 changes: 3 additions & 2 deletions pkg/epp/scheduling/framework/plugins/picker/random_picker.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
// compile-time type validation
var _ framework.Picker = &RandomPicker{}

// RandomPickerFactory defines the factory function for RandomPicker.
func RandomPickerFactory(name string, rawParameters json.RawMessage, _ plugins.Handle) (plugins.Plugin, error) {
parameters := pickerParameters{MaxNumOfEndpoints: DefaultMaxNumOfEndpoints}
if rawParameters != nil {
Expand Down Expand Up @@ -80,8 +81,8 @@ func (p *RandomPicker) TypedName() plugins.TypedName {

// Pick selects random pod(s) from the list of candidates.
func (p *RandomPicker) Pick(ctx context.Context, _ *types.CycleState, scoredPods []*types.ScoredPod) *types.ProfileRunResult {
log.FromContext(ctx).V(logutil.DEBUG).Info(fmt.Sprintf("Selecting maximum '%d' pods from %d candidates randomly: %+v", p.maxNumOfEndpoints,
len(scoredPods), scoredPods))
log.FromContext(ctx).V(logutil.DEBUG).Info("Selecting pods from candidates randomly", "max-num-of-endpoints", p.maxNumOfEndpoints,
"num-of-candidates", len(scoredPods), "scored-pods", scoredPods)

// TODO: merge this with the logic in MaxScorePicker
// Rand package is not safe for concurrent use, so we create a new instance.
Expand Down