-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Make it possible to attach a PayloadProcessor to process model predictions #84
Conversation
A README is provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow @tteofili -- this is an impressively quick turn around on a prototype! And your code looks well written and well structured!
I need to delegate the actual review of the logic to @njhill and I have not worked on any Java code in almost 10 years, so I only have a few superficial comments/questions for now (please forgive my ignorance if I missed a few steps :-)
I assume you are still working to add some test cases?
Re: failed DCO check:
How to fix the DCO check
|
I think I've fixed the missing |
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tteofili thanks ever so much for this! The changes look like a great start.
I made a few comments inline but here are my main thoughts:
I don't think the current calls to process the payload in the invokeModel
are the best places to do this. Better would be in the ModelMeshApi class.
Specifically somewhere around here.
It would probably be good to have two separate calls, one for the request and one for the response. Since at this point the request has already been released. So the place to log the request could be around here. And we need to think about the error case, if/how to log the response in that case.
Rather than opaque Objects in the Payload we can have concrete types i.e. for the request it can be ByteBuf
for the payload and Metadata
(this is a grpc class). For the response it can be the ModelResponse
object that contains both of those and has its own release()
method.
These should be enqueued if the payload logging is enabled and that should take ownership i.e. be responsible for releasing the buffers after they have been dequeued and processed. It's important that this is watertight i.e. if the enqueue fails they must be released as they are now.
I'd suggest we make the new sub package name payload
rather than processor
since it's a bit less generic.
I have more comments but hopefully this is enough for a first pass!
src/main/java/com/ibm/watson/modelmesh/processor/FileWriterPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/LoggingPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/MatchingPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/MatchingPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/MatchingPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/CompositePayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/AsyncPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/processor/AsyncPayloadProcessor.java
Outdated
Show resolved
Hide resolved
We should probably include both the modelId and vModelId with each payload (latter may be null). |
…eq/resp separately Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
this is still in a work in progress state, however I hope most of the comments got addressed. |
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
…ayload processor Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
@tteofili I have pushed a commit with some suggested changes to this branch, perhaps you could cherry pick it to your PR branch if they look ok. Other things which I didn't address and would be good if you could have a go at are:
|
thanks so much @njhill for your help.
I don't get the logic behind the Also I think it's reasonable to assume that a
ok, I've included also in the remote processor.
sure, I'll add that part too. |
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
@njhill I've included your patch, with minor changes and implemented the some other points you raised. |
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tteofili thanks again for all your work and patience with this.
Only a few minor remaining comments which should hopefully be quick to address. I will look out for updates and get it merged quickly.
src/main/java/com/ibm/watson/modelmesh/payload/RemotePayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/payload/LoggingPayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/payload/RemotePayloadProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ibm/watson/modelmesh/payload/AsyncPayloadProcessor.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
@njhill I've included your most recent comments, please let me know if you want me to address anything else. |
src/main/java/com/ibm/watson/modelmesh/payload/RemotePayloadProcessor.java
Show resolved
Hide resolved
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
Signed-off-by: Tommaso Teofili <tteofili@redhat.com>
@njhill I've also included the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tteofili thanks again for all of the great work!
There's one remaining small question about including error messages in the remote-published payloads in addition to the code, but no harm in handling that later.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njhill, tteofili The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
#339) #### Motivation In order to integrate with the upcoming [ModelMesh payload processing feature](kserve/modelmesh#84 (comment)), the MM_PAYLOAD_PROCESSOR environment variable within the ModelMesh image needs to point at the endpoint of the payload processing service within the cluster. By setting this as a variable set in the config.yaml, it allows for a variety of payload processing or logging services to be plugged in via the deployment manifest. #### Modifications - Added PayloadProcessor field to the `controllers/mmesh/modelmesh.go` Deployment struct - Added PayloadProcessor field to the `pkg/config/config.go` Config struct - Added default setting of this field to an empty string within `pkg/config/config.go` - Added functions in `controllers/suite_text.go` to load a config file that specifies the Payload processor - these tests ensure the default value of `MM_PAYLOAD_PROCESSOR` is empty, while it receives the correct value if such a field is present in the config yaml file #### Result - Ability to set MM_PAYLOAD_PROCESSOR env variable via config.yaml - If no such variable is set, the only effect is the ModelMesh image receives an empty env var Signed-off-by: robgeada <rob@geada.net>
kserve#339) #### Motivation In order to integrate with the upcoming [ModelMesh payload processing feature](kserve/modelmesh#84 (comment)), the MM_PAYLOAD_PROCESSOR environment variable within the ModelMesh image needs to point at the endpoint of the payload processing service within the cluster. By setting this as a variable set in the config.yaml, it allows for a variety of payload processing or logging services to be plugged in via the deployment manifest. #### Modifications - Added PayloadProcessor field to the `controllers/mmesh/modelmesh.go` Deployment struct - Added PayloadProcessor field to the `pkg/config/config.go` Config struct - Added default setting of this field to an empty string within `pkg/config/config.go` - Added functions in `controllers/suite_text.go` to load a config file that specifies the Payload processor - these tests ensure the default value of `MM_PAYLOAD_PROCESSOR` is empty, while it receives the correct value if such a field is present in the config yaml file #### Result - Ability to set MM_PAYLOAD_PROCESSOR env variable via config.yaml - If no such variable is set, the only effect is the ModelMesh image receives an empty env var Signed-off-by: robgeada <rob@geada.net>
Motivation
This PR seeks to address the model-mesh side of kserve/modelmesh-serving#284.
Modifications
It provides a
PayloadProcessor
interface.PayloadProcessors
are picked byModelMesh
instances at startup and predictions (Payloads
) are processed asynchronously at fixed timing.A first logger implementation allows to log
Payloads
(at info level).Result
A SPI for post processing model predictions.
resolves kserve/modelmesh-serving#284