Skip to content

Conversation

@OneSizeFitsQuorum
Copy link
Contributor

  • Update the docstring for ray.shutdown() in python/ray/_private/worker.py to clarify:
    • When connecting to a remote cluster via ray.init(address="xxx"), ray.shutdown() only disconnects the client and does NOT terminate the remote cluster
    • Only local clusters started by ray.init() will have their processes terminated by ray.shutdown()
    • Clarified that ray.init() without address argument will auto-detect existing clusters
  • Add documentation note to doc/source/ray-core/starting-ray.rst explaining the same behavior difference
  • Review the changes via code_review
  • Run codeql_checker for security scan (no code changes requiring analysis)

@OneSizeFitsQuorum OneSizeFitsQuorum requested review from a team as code owners January 5, 2026 08:54
@OneSizeFitsQuorum OneSizeFitsQuorum changed the title 【DOC】Clarify ray.shutdown() behavior for local vs remote clusters [DOC]Clarify ray.shutdown() behavior for local vs remote clusters Jan 5, 2026
@OneSizeFitsQuorum OneSizeFitsQuorum changed the title [DOC]Clarify ray.shutdown() behavior for local vs remote clusters [Doc]Clarify ray.shutdown() behavior for local vs remote clusters Jan 5, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request clarifies the behavior of ray.shutdown() in both the API docstring and the core documentation. The changes are clear and accurate. I have a couple of suggestions to make the explanation even more explicit for users who call ray.init() without arguments, which is a very common use case.

I am having trouble creating individual review comments. Click here to see my feedback.

doc/source/ray-core/starting-ray.rst (86)

medium

To improve clarity, it would be helpful to explicitly mention that ray.init() with no arguments can also connect to an existing cluster. This is a very common use case and adding it to the examples would make the documentation more complete.

  * If you connected to an existing cluster (e.g., via ``ray.init()`` when a cluster is already running, ``ray.init(address="auto")``, or ``ray.init(address="ray://<ip>:<port>")``), ``ray.shutdown()`` only disconnects the client -- it does **not** shut down the remote cluster.

python/ray/_private/worker.py (2031-2033)

medium

For better clarity, let's explicitly mention the case where ray.init() without arguments connects to an existing cluster. This makes the documentation more comprehensive for this common scenario.

        * If you connected to an existing cluster (e.g., by calling
          ``ray.init()`` when a cluster is already running, using
          ``ray.init(address="auto")``, or ``ray.init(address="ray://<ip>:<port>")``),
          ``ray.shutdown()`` will only disconnect the client from the cluster.

@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Jan 5, 2026
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.

Thank you!

@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jan 6, 2026
@edoakes edoakes enabled auto-merge (squash) January 6, 2026 01:06
@edoakes edoakes merged commit 28dd231 into ray-project:master Jan 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core 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