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

[Serve] Return 400 response code for malformed Serve configs sent via REST API #31379

Merged
merged 2 commits into from
Jan 4, 2023

Conversation

shrekris-anyscale
Copy link
Contributor

Signed-off-by: Shreyas Krishnaswamy shrekris@anyscale.com

Why are these changes needed?

When users submit a malformed Serve config (e.g. with invalid fields) via PUT request, they receive a 500 error. This change makes the REST API return a 400 (unretryable) error instead.

Related issue number

Closes #31370

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
      • New unit tests are added to test_serve_agent.py.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
m4tx Mateusz Maćkowski
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
@@ -115,8 +115,15 @@ async def delete_serve_application(self, req: Request) -> Response:
async def put_all_deployments(self, req: Request) -> Response:
from ray.serve.schema import ServeApplicationSchema
from ray.serve._private.api import serve_start
from pydantic import ValidationError
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I delayed the pydantic import, so it doesn't become a dependency for the dashboard.

except ValidationError as e:
return Response(
status=400,
text=repr(e),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used repr instead of str since str sometimes fails for Unicode exceptions (see this StackOverflow thread for more info).

Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

Thanks!

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…chema
@edoakes edoakes merged commit 712cfc6 into ray-project:master Jan 4, 2023
AmeerHajAli pushed a commit that referenced this pull request Jan 12, 2023
… REST API (#31379)

When users submit a malformed Serve config (e.g. with invalid fields) via `PUT` request, they receive a 500 error. This change makes the REST API return a 400 (unretryable) error instead.
tamohannes pushed a commit to ju2ez/ray that referenced this pull request Jan 25, 2023
… REST API (ray-project#31379)

When users submit a malformed Serve config (e.g. with invalid fields) via `PUT` request, they receive a 500 error. This change makes the REST API return a 400 (unretryable) error instead.

Signed-off-by: tmynn <hovhannes.tamoyan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[serve] REST API should return 400 response code for malformed input
4 participants