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] Enable passing starlette requests w/ a warning #37046

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

edoakes
Copy link
Contributor

@edoakes edoakes commented Jul 3, 2023

Why are these changes needed?

In the new streaming codepath, the starlette.requests.Request object is no longer serializable so it cannot be passed directly via ServeHandle.

This is an anti-pattern because the request may not be fully functioning (e.g., detecting disconnects won't work). However, some existing code may rely on it, so in this change we add support by buffering the requests but print a warning message to discourage usage.

Related issue number

#37027

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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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
    • Release tests
    • This PR is not tested :(

Signed-off-by: Edward Oakes <[email protected]>
@edoakes edoakes requested a review from a team July 3, 2023 17:09
Signed-off-by: Edward Oakes <[email protected]>
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.

LGTM, thanks Ed!

Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Nice work!

@@ -45,6 +49,9 @@

logger = logging.getLogger(SERVE_LOGGER_NAME)

# Used to only print a single warning when users pass starlette requests via handle.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Used to only print a single warning when users pass starlette requests via handle.
# Used only to print a single warning when users pass starlette requests via handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The phrasing is as-is to specify that it's used "used to only print a single" versus printing multiple.

Not that this variable is "only used to print" a warning

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh got it, could we phrase it like this:

Suggested change
# Used to only print a single warning when users pass starlette requests via handle.
# Used to print only a single warning when users pass starlette requests via handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah not going to wait for another build for it though, if it fails i'll update it

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good.

@edoakes
Copy link
Contributor Author

edoakes commented Jul 3, 2023

Manually tested the microbenchmark locally, working

@edoakes edoakes merged commit 2b32260 into ray-project:master Jul 3, 2023
35 checks passed
SongGuyang pushed a commit to alipay/ant-ray that referenced this pull request Jul 12, 2023
…7046)

In the new streaming codepath, the starlette.requests.Request object is no longer serializable so it cannot be passed directly via ServeHandle.

This is an anti-pattern because the request may not be fully functioning (e.g., detecting disconnects won't work). However, some existing code may rely on it, so in this change we add support by buffering the requests but print a warning message to discourage usage.

Signed-off-by: 久龙 <[email protected]>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…7046)

In the new streaming codepath, the starlette.requests.Request object is no longer serializable so it cannot be passed directly via ServeHandle.

This is an anti-pattern because the request may not be fully functioning (e.g., detecting disconnects won't work). However, some existing code may rely on it, so in this change we add support by buffering the requests but print a warning message to discourage usage.

Signed-off-by: harborn <[email protected]>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…7046)

In the new streaming codepath, the starlette.requests.Request object is no longer serializable so it cannot be passed directly via ServeHandle.

This is an anti-pattern because the request may not be fully functioning (e.g., detecting disconnects won't work). However, some existing code may rely on it, so in this change we add support by buffering the requests but print a warning message to discourage usage.
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…7046)

In the new streaming codepath, the starlette.requests.Request object is no longer serializable so it cannot be passed directly via ServeHandle.

This is an anti-pattern because the request may not be fully functioning (e.g., detecting disconnects won't work). However, some existing code may rely on it, so in this change we add support by buffering the requests but print a warning message to discourage usage.

Signed-off-by: e428265 <[email protected]>
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.

None yet

3 participants