Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit ca12b30

Browse files
authored
Merge pull request #105 from neuralmagic/debug-pd
add log lines
2 parents 2f6a763 + 867b18c commit ca12b30

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ go.work.sum
3030

3131
# generated docs
3232
site
33+
34+
.envrc

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ image-build: check-container-tool load-version-json ## Build container image usi
494494
--build-arg TARGETARCH=$(TARGETARCH) \
495495
--build-arg GIT_NM_USER=$(GIT_NM_USER)\
496496
--build-arg NM_TOKEN=$(NM_TOKEN) \
497+
--progress=plain \
497498
-t $(IMG) .
498499

499500
.PHONY: image-push

pkg/epp/scheduling/local_config.go

+1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ func setPDFilter() {
9090
}
9191

9292
defaultConfig.filters = append(defaultConfig.filters, filter.PDFilter)
93+
loggerDebug.Info("Initialized PDFilter")
9394
}

pkg/epp/scheduling/plugins/filter/pd_filter.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import (
1919
"fmt"
2020
"math/rand/v2"
2121

22+
"sigs.k8s.io/controller-runtime/pkg/log"
2223
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/metrics"
2324
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
25+
logutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/logging"
2426
)
2527

2628
const (
@@ -42,6 +44,8 @@ var PDFilter = &baseFilter{
4244
// Returns:
4345
// - Filtered slice of pod metrics, could contain one or zerro elements
4446
func prefillDecodeFilterFunc(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod {
47+
loggerDebug := log.FromContext(ctx).WithName("pd_filter").V(logutil.DEBUG)
48+
4549
pPods := make([]types.Pod, 0)
4650
dPods := make([]types.Pod, 0)
4751

@@ -56,7 +60,10 @@ func prefillDecodeFilterFunc(ctx *types.SchedulingContext, pods []types.Pod) []t
5660
if len(pPods) > 0 {
5761
// select a random prefill pod
5862
randomIndex := rand.IntN(len(pPods))
59-
ctx.MutatedHeaders[prefillPodHeader] = fmt.Sprintf("http://%s:%d", pPods[randomIndex].GetPod().Address, ctx.TargetPort)
63+
url := fmt.Sprintf("http://%s:%d", pPods[randomIndex].GetPod().Address, ctx.TargetPort)
64+
loggerDebug.Info("Prefill pod selected", "url", url)
65+
66+
ctx.MutatedHeaders[prefillPodHeader] = url
6067
}
6168

6269
if len(dPods) > 1 {

0 commit comments

Comments
 (0)