-
Notifications
You must be signed in to change notification settings - Fork 834
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
fix(adserver): adserver returns cloudevents compatible response #5348
fix(adserver): adserver returns cloudevents compatible response #5348
Conversation
@@ -21,7 +21,7 @@ | |||
SELDON_PREDICTOR_ID = DEFAULT_LABELS["predictor_name"] | |||
|
|||
|
|||
def _load_class_module(module_path: str) -> str: | |||
def _load_class_module(module_path: str): |
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.
Why? It still seems to return str
, or not?
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.
It actually returns a Module
. It was raising type hint warnings because it's used like so in L77-79
# Load from locally available models
MetricsClass = _load_class_module(self.storage_uri)
self.model = MetricsClass()
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.
so potentially -> "Module"
(or other appropriate way to annotate the return type) could be good?
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.
probably you'd need to import appropriate type
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.
Probably best for another approval from someone with more up-to-date production python knowledge, but logic looks good to me.
Good job on getting this resolved properly!
@michaelcheah please mark as |
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.
LGTM 🚀
What this PR does / why we need it:
The
adserver
is meant to be deployed as a knative serving service. However, it is currently not setting the appropriate headers in its http response in the POST handler for the response to be considered a CloudEvent message. As can be seen by the spec, the following attributes must be present in the http message:Previously, none of these attributes were set in the response (though they were set when the message was forwarded to the
replyUrl
)This PR does the following:
test_server.py
file to check that responses are CE compatible