Skip to content

Commit 1a7b40e

Browse files
nirrozenbaumahg-gelevran
authored andcommitted
added context argument to scheduling profile picker (kubernetes-sigs#926)
* added context argument to scheduling profile picker since this is a custom logic, getting context as argument can be useful. specific in my case I want to use contextual logging Signed-off-by: Nir Rozenbaum <[email protected]> * Update pkg/epp/scheduling/framework/plugins/profile-picker/all_profiles_picker.go Co-authored-by: Etai Lev Ran <[email protected]> --------- Signed-off-by: Nir Rozenbaum <[email protected]> Co-authored-by: Abdullah Gharaibeh <[email protected]> Co-authored-by: Etai Lev Ran <[email protected]>
1 parent 73a4a73 commit 1a7b40e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pkg/epp/scheduling/framework/plugins.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
// and the previously executed SchedluderProfile cycles along with their results.
3636
type ProfilePicker interface {
3737
plugins.Plugin
38-
Pick(request *types.LLMRequest, profiles map[string]*SchedulerProfile, executionResults map[string]*types.Result) map[string]*SchedulerProfile
38+
Pick(ctx context.Context, request *types.LLMRequest, profiles map[string]*SchedulerProfile, executionResults map[string]*types.Result) map[string]*SchedulerProfile
3939
}
4040

4141
// Filter defines the interface for filtering a list of pods based on context.

pkg/epp/scheduling/framework/plugins/profile-picker/all_profiles_picker.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package profilepicker
1818

1919
import (
20+
"context"
2021
"encoding/json"
2122

2223
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
@@ -51,7 +52,8 @@ func (p *AllProfilesPicker) Name() string {
5152

5253
// Pick selects the SchedulingProfiles to run from the list of candidate profiles, while taking into consideration the request properties and the
5354
// previously executed cycles along with their results.
54-
func (p *AllProfilesPicker) Pick(request *types.LLMRequest, profiles map[string]*framework.SchedulerProfile, executionResults map[string]*types.Result) map[string]*framework.SchedulerProfile {
55+
func (p *AllProfilesPicker) Pick(_ context.Context, request *types.LLMRequest, profiles map[string]*framework.SchedulerProfile,
56+
executionResults map[string]*types.Result) map[string]*framework.SchedulerProfile {
5557
if len(profiles) == len(executionResults) { // all profiles have been executed already in previous call
5658
return map[string]*framework.SchedulerProfile{}
5759
}

pkg/epp/scheduling/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (s *Scheduler) Schedule(ctx context.Context, request *types.LLMRequest) (ma
112112

113113
for { // get the next set of profiles to run iteratively based on the request and the previous execution results
114114
before := time.Now()
115-
profiles := s.profilePicker.Pick(request, s.profiles, profileExecutionResults)
115+
profiles := s.profilePicker.Pick(ctx, request, s.profiles, profileExecutionResults)
116116
metrics.RecordSchedulerPluginProcessingLatency(framework.ProfilePickerType, s.profilePicker.Name(), time.Since(before))
117117
if len(profiles) == 0 { // profile picker didn't pick any profile to run
118118
break

0 commit comments

Comments
 (0)