Skip to content

Commit dba0d27

Browse files
committed
Review comments
1 parent 7c9eb76 commit dba0d27

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

config/manifests/ext_proc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ spec:
7575
imagePullPolicy: Always
7676
args:
7777
- -poolName
78-
- "vllm-llama2-7b-pool"
78+
- "my-pool"
7979
- -v
8080
- "4"
8181
- -grpcPort

pkg/epp/handlers/streamingserver.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ func (s *StreamingServer) Process(srv extProcPb.ExternalProcessor_ProcessServer)
5858
decoder := json.NewDecoder(reader)
5959

6060
var requestBody, responseBody map[string]interface{}
61-
// Create variable for error handling as each request should only report once for
62-
// error metric. This doesn't cover the error "Cannot receive stream request" because
63-
// such error might happen even the response is processed.
61+
// Create error handling var as each request should only report once for
62+
// error metrics. This doesn't cover the error "Cannot receive stream request" because
63+
// such errors might happen even though response is processed.
6464
var err error
6565
defer func(error) {
6666
if reqCtx.ResponseStatusCode != "" {
@@ -93,6 +93,11 @@ func (s *StreamingServer) Process(srv extProcPb.ExternalProcessor_ProcessServer)
9393
// Do nothing. Header info is handled in the HandleRequestBody func
9494
case *extProcPb.ProcessingRequest_RequestBody:
9595
loggerVerbose.Info("Incoming body chunk", "body", string(v.RequestBody.Body), "EoS", v.RequestBody.EndOfStream)
96+
// In the stream case, we can receive multiple request bodies.
97+
// To buffer the full message, we create a goroutine with a writer.Write()
98+
// call, which will block until the corresponding reader reads from it.
99+
// We do not read until we receive the EndofStream signal, and then
100+
// decode the entire JSON body.
96101
go func() {
97102
_, err := writer.Write(v.RequestBody.Body)
98103
if err != nil {
@@ -260,7 +265,6 @@ type StreamingRequestContext struct {
260265
Model string
261266
ResolvedTargetModel string
262267
RequestState StreamRequestState
263-
EndOfStream bool
264268
RequestReceivedTimestamp time.Time
265269
ResponseCompleteTimestamp time.Time
266270
RequestSize int

0 commit comments

Comments
 (0)