Skip to content

[Docs] Fix async code in serving notebook #53864

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

Merged
merged 11 commits into from
Jun 19, 2025
Merged

Conversation

crypdick
Copy link
Contributor

Why are these changes needed?

Async code works in scripts/CI but not on jupyter notebooks on Workspaces.

Related issue number

N/A

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 :(

crypdick added 2 commits June 16, 2025 15:10
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
@Copilot Copilot AI review requested due to automatic review settings June 16, 2025 22:16
@crypdick crypdick requested a review from a team as a code owner June 16, 2025 22:16
@crypdick crypdick added docs An issue or change related to documentation go add ONLY when ready to merge, run all tests labels Jun 16, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates async execution in Jupyter notebooks by adding a wait flag for notebook conversion and converting the serving test into proper async functions with error handling.

  • Added --wait flag to ensure the notebook conversion completes before execution.
  • Changed test_serve to an async def, added response.raise_for_status(), and updated invocation to use await.
  • Adjusted fetch_all_concurrently usage to return predictions and print a completion message.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
doc/source/ray-overview/examples/e2e-xgboost/notebooks/01-Distributed_Training.ipynb Added --wait flag to the Ray CLI invocation for notebook scripts
doc/source/ray-overview/examples/e2e-timeseries/e2e_timeseries/03-Serving.ipynb Updated serving test to async, improved HTTP error handling, and updated invocation
Comments suppressed due to low confidence (2)

doc/source/ray-overview/examples/e2e-timeseries/e2e_timeseries/03-Serving.ipynb:302

  • [nitpick] Since return_exceptions=True prevents errors from propagating, consider setting it to False or explicitly handling exceptions in the returned responses list to avoid silent failures.
responses = await asyncio.gather(*tasks, return_exceptions=True)

doc/source/ray-overview/examples/e2e-xgboost/notebooks/01-Distributed_Training.ipynb:890

  • [nitpick] Consider adding a comment explaining why the --wait flag is necessary for notebook conversions to complete before execution, improving clarity for readers.
--wait \\

Copy link
Contributor

@angelinalg angelinalg left a comment

Choose a reason for hiding this comment

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

stamp

crypdick and others added 2 commits June 17, 2025 15:37
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
@crypdick crypdick force-pushed the docs/minor-improvements branch from 166048d to ce6d594 Compare June 17, 2025 23:42
crypdick added 7 commits June 17, 2025 17:36
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
Signed-off-by: Ricardo Decal <rdecal@anyscale.com>
@angelinalg angelinalg merged commit 2be023b into master Jun 19, 2025
5 checks passed
@angelinalg angelinalg deleted the docs/minor-improvements branch June 19, 2025 22:38
rebel-scottlee pushed a commit to rebellions-sw/ray that referenced this pull request Jun 21, 2025
Signed-off-by: Scott Lee <scott.lee@rebellions.ai>
minerharry pushed a commit to minerharry/ray that referenced this pull request Jun 27, 2025
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
goutamvenkat-anyscale pushed a commit to goutamvenkat-anyscale/ray that referenced this pull request Jul 4, 2025
Signed-off-by: Goutam V <goutam@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs An issue or change related to documentation go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants