mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 16:46:43 +08:00
Use process reaper for cleanup (#6253)
This commit is contained in:
@@ -327,7 +327,8 @@ def start(node_ip_address, redis_address, address, redis_port,
|
||||
include_java=False,
|
||||
)
|
||||
|
||||
node = ray.node.Node(ray_params, head=True, shutdown_at_exit=block)
|
||||
node = ray.node.Node(
|
||||
ray_params, head=True, shutdown_at_exit=block, spawn_reaper=block)
|
||||
redis_address = node.redis_address
|
||||
|
||||
logger.info(
|
||||
@@ -395,7 +396,8 @@ def start(node_ip_address, redis_address, address, redis_port,
|
||||
check_no_existing_redis_clients(ray_params.node_ip_address,
|
||||
redis_client)
|
||||
ray_params.update(redis_address=redis_address)
|
||||
node = ray.node.Node(ray_params, head=False, shutdown_at_exit=block)
|
||||
node = ray.node.Node(
|
||||
ray_params, head=False, shutdown_at_exit=block, spawn_reaper=block)
|
||||
logger.info("\nStarted Ray on this node. If you wish to terminate the "
|
||||
"processes that have been started, run\n\n"
|
||||
" ray stop")
|
||||
@@ -436,7 +438,6 @@ def stop(force, verbose):
|
||||
# See STANDARD FORMAT SPECIFIERS section of
|
||||
# http://man7.org/linux/man-pages/man1/ps.1.html
|
||||
# about comm and args. This can help avoid killing non-ray processes.
|
||||
|
||||
# Format:
|
||||
# Keyword to filter, filter by command (True)/filter by args (False)
|
||||
["raylet", True],
|
||||
@@ -450,12 +451,9 @@ def stop(force, verbose):
|
||||
["log_monitor.py", False],
|
||||
["reporter.py", False],
|
||||
["dashboard.py", False],
|
||||
["ray_process_reaper.py", False],
|
||||
]
|
||||
|
||||
signal_name = "TERM"
|
||||
if force:
|
||||
signal_name = "KILL"
|
||||
|
||||
for process in processes_to_kill:
|
||||
keyword, filter_by_cmd = process
|
||||
if filter_by_cmd:
|
||||
@@ -475,7 +473,7 @@ def stop(force, verbose):
|
||||
"kill -s {} $(ps ax -o {} | grep {} | grep -v grep {} | grep ray |"
|
||||
"awk '{{ print $1 }}') 2> /dev/null".format(
|
||||
# ^^ This is how you escape braces in python format string.
|
||||
signal_name,
|
||||
"KILL" if force else "TERM",
|
||||
ps_format,
|
||||
keyword,
|
||||
debug_operator))
|
||||
|
||||
Reference in New Issue
Block a user