Skip to content
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

Java Wrapper JSON POST API regression fix #3211

Merged
merged 7 commits into from
May 20, 2021

Conversation

amoldavsky
Copy link
Contributor

Fixes #3210

Special notes for your reviewer:
Fixes a regression which was not present in earlier versions

Referencing the following Slack discussion:
#3210

Does this PR introduce a user-facing change?:

NONE

@seldondev
Copy link
Collaborator

Hi @amoldavsky. Thanks for your PR.

I'm waiting for a SeldonIO or todo member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

@seldondev
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign rafalskolasinski
You can assign the PR to them by writing /assign @rafalskolasinski in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment


@RestController
@ConditionalOnExpression("${seldon.api.model.enabled:false}")
public class ModelRestController {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on our discussion here:
https://seldondev.slack.com/archives/C8Y9A8G0Y/p1621264214141000?thread_ts=1620740550.073300&cid=C8Y9A8G0Y

This is not a Rest API, this is just an HTTP API. There is no resource in question such as a user or a document. We are not event doing a query here, such as querying for a document in Solr or ElasticSearch.

The appropriate distinction to make is from an actual Rest API and an Inference API. A Rest API would be an API to get or alter the state of the model - load, unload, update, get meta... etc. An Inference API would be this exact /predict endpoint which does some computation and spits out a result.

* @return
* @deprecated
*/
@Deprecated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are not doing Rest, there is no need for a call /predict?json="{...}" and hence deserves the deprecation tag

method = {RequestMethod.POST},
consumes = {
MediaType.APPLICATION_JSON_VALUE,
MediaType.APPLICATION_JSON_UTF8_VALUE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPLICATION_JSON_UTF8_VALUE is for backward compatibility, this property is deprecated by Spring

.setData(DefaultData.newBuilder().setTensor(Tensor.newBuilder().addShape(1).addValues(1.0)))
.build();
// echo payload back
return payload.toBuilder().build();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more practical to return a copy of the payload back for testing. This makes sure that the payload is not deformed along the way and allows you to target particular pathways with different payloads.

// TODO: add binData
// TODO: add strData
// TODO: add customData

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A collection of all possible payloads for SeldonMessage.
This way all possible requests are in one location and easy to see.
This allows us to easily test all possible assemblies of SeldonMessage.

@ukclivecox ukclivecox merged commit 53a7f86 into SeldonIO:master May 20, 2021
RafalSkolasinski pushed a commit that referenced this pull request May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java Wrapper /predict API regression
3 participants