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
5 changes: 3 additions & 2 deletions pkg/epp/scheduling/plugins/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ func TestFilter(t *testing.T) {
},
},
{
name: "lowQueueAndLessThanKVCacheThresholdPredicate",
filter: &HasCapacityFilter{queueThreshold: 0, kvCacheThreshold: 0.8},
name: "SheddableCapacityFilter, sheddable request",
req: &types.LLMRequest{Critical: false},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can you also add a test case on Critical: true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe not worth the effort considering #808 --> #805.

filter: &SheddableCapacityFilter{queueThreshold: 0, kvCacheThreshold: 0.8},
input: []types.Pod{
&types.PodMetrics{
// This pod should be returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,33 @@ import (
)

// compile-time type validation
var _ plugins.Filter = &HasCapacityFilter{}
var _ plugins.Filter = &SheddableCapacityFilter{}

// NewHasCapacityFilter returns a new HasCapacityFilter.
func NewHasCapacityFilter() *HasCapacityFilter {
return &HasCapacityFilter{
// NewSheddableCapacityFilter returns a new SheddableCapacityFilter.
func NewSheddableCapacityFilter() *SheddableCapacityFilter {
return &SheddableCapacityFilter{
queueThreshold: config.Conf.QueueThresholdCritical,
kvCacheThreshold: config.Conf.KVCacheThreshold,
}
}

// HasCapacityFilter filters only pods that has capacity for sheddable requests.
type HasCapacityFilter struct {
// SheddableCapacityFilter filters only pods that has capacity for sheddable requests.
type SheddableCapacityFilter struct {
queueThreshold int
kvCacheThreshold float64
}

// Name returns the name of the filter.
func (f *HasCapacityFilter) Name() string {
return "has-capacity"
func (f *SheddableCapacityFilter) Name() string {
return "sheddable-capacity"
}

// Filter filters out pods that doesn't meet the filter criteria.
func (f *HasCapacityFilter) Filter(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod {
func (f *SheddableCapacityFilter) Filter(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod {
if ctx.Req.Critical {
return pods // // Allow all pods to passthrough if the request is critical, even if all pods reach their capacity.
}

filteredPods := []types.Pod{}

for _, pod := range pods {
Expand Down
53 changes: 0 additions & 53 deletions pkg/epp/scheduling/plugins/filter/sheddable_request_filter.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/epp/scheduling/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewScheduler(datastore Datastore) *Scheduler {

defaultConfig := &SchedulerConfig{
preSchedulePlugins: []plugins.PreSchedule{},
filters: []plugins.Filter{filter.NewSheddableRequestFilter(), lowLatencyFilter},
filters: []plugins.Filter{filter.NewSheddableCapacityFilter(), lowLatencyFilter},
scorers: map[plugins.Scorer]int{},
picker: &picker.RandomPicker{},
postSchedulePlugins: []plugins.PostSchedule{},
Expand Down