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] raise RequestCancelledError when request is cancelled during assignment #48496

Merged
merged 5 commits into from
Nov 4, 2024

Conversation

zcin
Copy link
Contributor

@zcin zcin commented Nov 1, 2024

Why are these changes needed?

Currently ray.serve.exceptions.RequestCancelledError is raised only when a request is cancelled during execution. We should also raise RequestCancelledError when a request is cancelled during assignment.

@zcin zcin requested review from GeneDer and edoakes November 1, 2024 16:55
Copy link
Contributor

@GeneDer GeneDer left a comment

Choose a reason for hiding this comment

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

:shipit:

@zcin zcin added the go add ONLY when ready to merge, run all tests label Nov 1, 2024
@zcin zcin enabled auto-merge (squash) November 1, 2024 18:44
Comment on lines 353 to 354
except asyncio.CancelledError:
raise RequestCancelledError from None
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this take the request ID as an arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm yeah, it's optional though. let me see if we can get ahold of the request metadata here.

Copy link
Contributor Author

@zcin zcin Nov 1, 2024

Choose a reason for hiding this comment

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

added request ID, ptal!

Tested manually, example:

Traceback (most recent call last):
  File "/Users/cindyz/workspace/test.py", line 44, in <module>
    second_response.result()
  File "/Users/cindyz/ray/python/ray/serve/handle.py", line 498, in result
    replica_result = self._fetch_future_result_sync(timeout_s)
  File "/Users/cindyz/ray/python/ray/serve/handle.py", line 334, in _fetch_future_result_sync
    raise RequestCancelledError(self.request_id) from None
ray.serve.exceptions.RequestCancelledError: Request 83479b13-3676-46d3-9193-6be135718f2a was cancelled.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe let's make it required so this is consistent

@github-actions github-actions bot disabled auto-merge November 1, 2024 19:33
Copy link
Contributor

@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.

nice!

Signed-off-by: Cindy Zhang <[email protected]>
@zcin zcin merged commit d5d03e6 into ray-project:master Nov 4, 2024
5 checks passed
Jay-ju pushed a commit to Jay-ju/ray that referenced this pull request Nov 5, 2024
…assignment (ray-project#48496)

## Why are these changes needed?

Currently `ray.serve.exceptions.RequestCancelledError` is raised only
when a request is cancelled during execution. We should also raise
`RequestCancelledError` when a request is cancelled during assignment.

---------

Signed-off-by: Cindy Zhang <[email protected]>
JP-sDEV pushed a commit to JP-sDEV/ray that referenced this pull request Nov 14, 2024
…assignment (ray-project#48496)

## Why are these changes needed?

Currently `ray.serve.exceptions.RequestCancelledError` is raised only
when a request is cancelled during execution. We should also raise
`RequestCancelledError` when a request is cancelled during assignment.

---------

Signed-off-by: Cindy Zhang <[email protected]>
mohitjain2504 pushed a commit to mohitjain2504/ray that referenced this pull request Nov 15, 2024
…assignment (ray-project#48496)

## Why are these changes needed?

Currently `ray.serve.exceptions.RequestCancelledError` is raised only
when a request is cancelled during execution. We should also raise
`RequestCancelledError` when a request is cancelled during assignment.

---------

Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: mohitjain2504 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants