From 4b4b5ca640cc29bce27178af3154b30f81908ce9 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 5 Sep 2022 09:33:05 +0100 Subject: [PATCH] Ensure request is chained before payload is logged (#4301) * Ensure request is chained before payload is logged * Update licenses * Fix chain / log order in transformOutput --- executor/licenses/dep.txt | 2 -- executor/predictor/predictor_process.go | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/executor/licenses/dep.txt b/executor/licenses/dep.txt index 201f5ec739..9051db9533 100644 --- a/executor/licenses/dep.txt +++ b/executor/licenses/dep.txt @@ -228,7 +228,6 @@ github.com/jstemmer/go-junit-report github.com/jtolds/gls github.com/julienschmidt/httprouter github.com/jung-kurt/gofpdf -github.com/kedacore/keda github.com/kedacore/keda/v2 github.com/kelseyhightower/envconfig github.com/kisielk/errcheck @@ -401,7 +400,6 @@ google.golang.org/protobuf gopkg.in/alecthomas/kingpin.v2 gopkg.in/check.v1 gopkg.in/errgo.v2 -gopkg.in/evanphx/json-patch.v4 gopkg.in/fsnotify.v1 gopkg.in/inf.v0 gopkg.in/ini.v1 diff --git a/executor/predictor/predictor_process.go b/executor/predictor/predictor_process.go index 6b6cc2868d..20cab9b711 100644 --- a/executor/predictor/predictor_process.go +++ b/executor/predictor/predictor_process.go @@ -100,6 +100,11 @@ func (p *PredictorProcess) transformInput(node *v1.PredictiveUnit, msg payload.S modelName := p.getModelName(node) if callModel || callTransformInput { + msg, err := p.Client.Chain(p.Ctx, modelName, msg) + if err != nil { + return nil, err + } + //Log Request if node.Logger != nil && (node.Logger.Mode == v1.LogRequest || node.Logger.Mode == v1.LogAll) { err := p.logPayload(node.Name, node.Logger, payloadLogger.InferenceRequest, msg, puid) @@ -108,10 +113,6 @@ func (p *PredictorProcess) transformInput(node *v1.PredictiveUnit, msg payload.S } } - msg, err := p.Client.Chain(p.Ctx, modelName, msg) - if err != nil { - return nil, err - } p.RoutingMutex.Lock() p.Routing[node.Name] = -1 p.RoutingMutex.Unlock() @@ -151,6 +152,11 @@ func (p *PredictorProcess) transformOutput(node *v1.PredictiveUnit, msg payload. modelName := p.getModelName(node) if callClient { + msg, err := p.Client.Chain(p.Ctx, modelName, msg) + if err != nil { + return nil, err + } + //Log Request if node.Logger != nil && (node.Logger.Mode == v1.LogRequest || node.Logger.Mode == v1.LogAll) { err := p.logPayload(node.Name, node.Logger, payloadLogger.InferenceRequest, msg, puid) @@ -159,10 +165,6 @@ func (p *PredictorProcess) transformOutput(node *v1.PredictiveUnit, msg payload. } } - msg, err := p.Client.Chain(p.Ctx, modelName, msg) - if err != nil { - return nil, err - } tmsg, err := p.Client.TransformOutput(p.Ctx, modelName, node.Endpoint.ServiceHost, p.getPort(node), msg, p.Meta.Meta) if tmsg != nil && err == nil { // Log Response