Skip to content

Commit fa2a92b

Browse files
committed
validate that single profile handler process only single profile
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
1 parent 96b3fd6 commit fa2a92b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/epp/scheduling/framework/plugins/profile/single_profile_handler.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package profile
1919
import (
2020
"context"
2121
"encoding/json"
22+
"errors"
2223
"fmt"
2324

2425
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
@@ -65,6 +66,10 @@ func (h *SingleProfileHandler) Pick(_ context.Context, request *types.LLMRequest
6566
// When a profile run fails, its result in the profileResults map is nil.
6667
func (h *SingleProfileHandler) ProcessResults(_ context.Context, _ *types.LLMRequest,
6768
profileResults map[string]*types.ProfileRunResult) (*types.SchedulingResult, error) {
69+
if len(profileResults) != 1 {
70+
return nil, errors.New("single profile handler is intended to be used with a single profile, failed to process multiple profiles")
71+
}
72+
6873
var singleProfileName string
6974
for profileName := range profileResults {
7075
singleProfileName = profileName

0 commit comments

Comments
 (0)