Running ray stop shutdowns all processes of different ray clusters

Hello,

I start two local ray instances on laptop using ray.init(), running ray stop on CLI causes both the instances to shutdown. Should ray stop have an argument of head node so that we stop desired ray instances?

instance 1:

conda activate ray
(ray) $ python
Python 3.7.0 (default, Jun 28 2018, 07:39:16) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ray
>>> ray.init()
2021-05-24 17:21:36,008	INFO services.py:1174 -- View the Ray dashboard at http://127.0.0.1:8265
{'node_ip_address': '192.168.1.5', 'raylet_ip_address': '192.168.1.5', 'redis_address': '192.168.1.5:6379', 'object_store_address': '/tmp/ray/session_2021-05-24_17-21-35_125024_32834/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2021-05-24_17-21-35_125024_32834/sockets/raylet', 'webui_url': '127.0.0.1:8265', 'session_dir': '/tmp/ray/session_2021-05-24_17-21-35_125024_32834', 'metrics_export_port': 60121, 'node_id': 'a9fc8975e9e6dbc1c62f01a5d97ac95948ec03cff77bd1ea03c11bf2'}

Instance 2

$ conda activate ray

(ray) $ python

Python 3.7.0 (default, Jun 28 2018, 07:39:16)

[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import ray

>>> ray.init()

2021-05-24 17:22:03,372 INFO services.py:1174 -- View the Ray dashboard at **http://127.0.0.1:8266**

{'node_ip_address': '192.168.1.5', 'raylet_ip_address': '192.168.1.5', 'redis_address': '192.168.1.5:52137', 'object_store_address': '/tmp/ray/session_2021-05-24_17-22-02_719214_32969/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2021-05-24_17-22-02_719214_32969/sockets/raylet', 'webui_url': '127.0.0.1:8266', 'session_dir': '/tmp/ray/session_2021-05-24_17-22-02_719214_32969', 'metrics_export_port': 54012, 'node_id': '10eebf10b8295bb7050d518a709af21019c4ba77eed0a9638ee2fe30'}

Running ray stop will shutdown both the cluster:

$ conda activate ray

(ray) $ ray stop

Stopped all 28 Ray processes.

cc @Alex who is working on namespaces.

it seems this issue still exists,any way to achieve this now in 2023.4?

I find another solution,just use subprocess call ray start with “–block”, and the main process watch an outside database to stop the subprocess,that will work fine