[Test] Cluster util fix (#8929)

This commit is contained in:
SangBin Cho
2020-06-29 12:15:41 -07:00
committed by GitHub
parent e060d99c6e
commit 7af6c69672
2 changed files with 15 additions and 4 deletions
+10
View File
@@ -128,6 +128,16 @@ class Cluster:
node (Node): Worker node of which all associated processes
will be removed.
"""
global_node = ray.worker._global_node
if global_node is not None:
if node._raylet_socket_name == global_node._raylet_socket_name:
ray.shutdown()
raise ValueError(
"Removing a node that is connected to this Ray client "
"is not allowed because it will break the driver."
"You can use the get_other_node utility to avoid removing"
"a node that the Ray client is connected.")
if self.head_node == node:
self.head_node.kill_all_processes(
check_alive=False, allow_graceful=allow_graceful)