Skip to content

Commit f0c52bc

Browse files
nirrozenbaumahg-gelevran
authored
added context argument to scheduling profile picker (#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 b62931e commit f0c52bc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package profilepicker
1818

1919
import (
20+
"context"
21+
2022
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
2123
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
2224
)
@@ -39,7 +41,8 @@ func (p *AllProfilesPicker) Name() string {
3941

4042
// Pick selects the SchedulingProfiles to run from the list of candidate profiles, while taking into consideration the request properties and the
4143
// previously executed cycles along with their results.
42-
func (p *AllProfilesPicker) Pick(request *types.LLMRequest, profiles map[string]*framework.SchedulerProfile, executionResults map[string]*types.Result) map[string]*framework.SchedulerProfile {
44+
func (p *AllProfilesPicker) Pick(_ context.Context, request *types.LLMRequest, profiles map[string]*framework.SchedulerProfile,
45+
executionResults map[string]*types.Result) map[string]*framework.SchedulerProfile {
4346
if len(profiles) == len(executionResults) { // all profiles have been executed already in previous call
4447
return map[string]*framework.SchedulerProfile{}
4548
}

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)