Skip to content

Commit

Permalink
Ensure request is chained before payload is logged (#4301)
Browse files Browse the repository at this point in the history
* Ensure request is chained before payload is logged

* Update licenses

* Fix chain / log order in transformOutput
  • Loading branch information
Adrian Gonzalez-Martin authored Sep 5, 2022
1 parent 7a94dbf commit 4b4b5ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions executor/licenses/dep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions executor/predictor/predictor_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 4b4b5ca

Please sign in to comment.