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] Upgrade deprecated calls #31839

Merged
merged 8 commits into from
Jan 25, 2023

Conversation

shrekris-anyscale
Copy link
Contributor

Why are these changes needed?

Serve uses ray.get_runtime_context().job_id and ray.get_runtime_context().node_id, which are deprecated. This raises long RayDeprecationWarning in the Serve CLI:

$ serve run example:graph
2023-01-21 17:19:08,723	INFO worker.py:1546 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265
...
2023-01-21 17:19:15,149	INFO worker.py:1546 -- Connected to Ray cluster. View the dashboard at http://127.0.0.1:8265
(ServeController pid=49525) INFO 2023-01-21 17:19:15,949 controller 49525 http_state.py:129 - Starting HTTP proxy with name 'SERVE_CONTROLLER_ACTOR:SERVE_PROXY_ACTOR-79e5c05fd95270ecf67b0d43e9aef485109c6724cf07121b46e361c0' on node '79e5c05fd95270ecf67b0d43e9aef485109c6724cf07121b46e361c0' listening on '127.0.0.1:8000'
(HTTPProxyActor pid=49530) INFO:     Started server process [49530]
/Users/shrekris/Desktop/ray/python/ray/serve/_private/client.py:487: RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"
Use get_job_id() instead
  "deployer_job_id": ray.get_runtime_context().job_id,
(ServeController pid=49525) INFO 2023-01-21 17:19:16,789 controller 49525 deployment_state.py:1311 - Adding 1 replica to deployment 'Pinger'.
(HTTPProxyActor pid=49530) /Users/shrekris/Desktop/ray/python/ray/serve/_private/common.py:228: RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"
(HTTPProxyActor pid=49530) Use get_job_id() instead
(HTTPProxyActor pid=49530)   "deployer_job_id": ray.get_runtime_context().job_id,
(ServeReplica:Pinger pid=49534) Changing target URL from "" to "localhost:8000"
(ServeReplica:Pinger pid=49534) /Users/shrekris/Desktop/ray/python/ray/serve/_private/replica.py:215: RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"
(ServeReplica:Pinger pid=49534) Use get_node_id() instead
(ServeReplica:Pinger pid=49534)   return ray.get_runtime_context().node_id
/Users/shrekris/Desktop/ray/python/ray/serve/_private/common.py:228: RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"
Use get_job_id() instead
  "deployer_job_id": ray.get_runtime_context().job_id,
2023-01-21 17:19:17,769	SUCC <string>:93 -- Deployed Serve app successfully.

This change makes Serve use get_job_id() and get_node_id() as recommended. It also updates Serve internals to always treat the job_id and node_id as a string. This removes the warnings:

$ serve run example:graph
2023-01-21 17:35:04,901	INFO worker.py:1546 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265 
2023-01-21 17:35:11,193	INFO <string>:62 -- Deploying from import path: example:graph.
2023-01-21 17:35:11,207	INFO worker.py:1244 -- Using address 127.0.0.1:63563 set in the environment variable RAY_ADDRESS
2023-01-21 17:35:11,208	INFO worker.py:1366 -- Connecting to existing Ray cluster at address: 127.0.0.1:63563...
2023-01-21 17:35:11,212	INFO worker.py:1546 -- Connected to Ray cluster. View the dashboard at http://127.0.0.1:8265
(ServeController pid=54348) INFO 2023-01-21 17:35:12,016 controller 54348 http_state.py:129 - Starting HTTP proxy with name 'SERVE_CONTROLLER_ACTOR:SERVE_PROXY_ACTOR-4d2397f0efde53dda4d529889e28d7c94561a4f2331cc402007dda5f' on node '4d2397f0efde53dda4d529889e28d7c94561a4f2331cc402007dda5f' listening on '127.0.0.1:8000'
(HTTPProxyActor pid=54352) INFO:     Started server process [54352]
(ServeController pid=54348) INFO 2023-01-21 17:35:12,853 controller 54348 deployment_state.py:1311 - Adding 1 replica to deployment 'Example'.
2023-01-21 17:35:13,834	SUCC <string>:93 -- Deployed Serve app successfully.

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 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
    • This change doesn't affect Serve's logic. It relies on existing unit tests.

Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Copy link
Contributor

@zcin zcin left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! One comment related to the Java codepath.

Comment on lines 384 to 387
if isinstance(deployer_job_id, bytes):
deployer_job_id = ray.JobID.from_int(
int.from_bytes(deployer_job_id, "little")
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think deployer_job_id might still be bytes if called from the Java codepath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch! I put the if statement back in, and I added a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, doesn't seem like the Java CI test is triggered... I'm not sure why or how to get it to run 😕

Copy link
Contributor

Choose a reason for hiding this comment

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

@sihanwang41 found today that they aren't triggered by Serve code changes (which is a bug). I believe he's filing a PR to fix this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @shrekris-anyscale, do you mind directly adding RAY_CI_JAVA_AFFECTED = 1 in https://github.com/ray-project/ray/blob/master/ci/pipeline/determine_tests_to_run.py#L181 . I am not 100% percent sure it can fix (only based on ci code reading), you can directly help to verify :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! I added it. Let's see if it kicks off the Java test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it kicked off the Java test.

Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
@shrekris-anyscale
Copy link
Contributor Author

The documentation failure is unrelated:

writing output... [100%] workflows/package-refst_data_in_and_outistization_utilse_examplexampleetcorTypey
--
  | /ray/doc/source/rllib/rllib-fault-tolerance.rst:68: WARNING: undefined label: tune-two-types-of-ckpt
  | generating indices... genindex py-modindex done
  | highlighting module code... [100%] tune_sklearn.tune_searcharchestionuhsearchduler_bufferereplay_buffer
  | writing additional pages... search done
  | copying images... [100%] workflows/trip.pngg.pngnsorboard.pngntal.png_analyze_results_35_1.pngzation_32_0.pngpng
  | copying downloadable files... [100%] /python/ray/tune/examples/tune-default.yamlinable.py
  | copying static files... done
  | copying extra files... done
  | dumping search index in English (code: en)... done
  | dumping object inventory... done
  | build finished with problems, 1 warning.
  | sitemap.xml was generated for URL https://docs.ray.io/en/latest/ in /ray/doc/_build/html/sitemap.xml
  | make: *** [Makefile:55: html] Error 1
  | 🚨 Error: The command exited with status 2

@shrekris-anyscale
Copy link
Contributor Author

@edoakes This change is ready to merge.

@edoakes
Copy link
Contributor

edoakes commented Jan 25, 2023

@sihanwang41 FYI this is getting merged including the java CI change

@edoakes edoakes merged commit 455100b into ray-project:master Jan 25, 2023
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.

4 participants