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

Make ray stop command also kill Java workers #4179

Merged
merged 2 commits into from
Mar 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 20 additions & 77 deletions python/ray/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,83 +378,24 @@ def start(node_ip_address, redis_address, redis_port, num_redis_shards,

@cli.command()
def stop():
# Find the PID of the plasma_store_server process and kill it.
subprocess.call(
[
"kill $(ps aux | grep plasma_store_server | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the raylet process and kill it.
subprocess.call(
[
"kill $(ps aux | grep raylet | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the raylet_monitor process and kill it.
subprocess.call(
[
"kill $(ps aux | grep raylet_monitor | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the monitor process and kill it.
subprocess.call(
[
"kill $(ps aux | grep monitor.py | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the Redis process and kill it.
subprocess.call(
[
"kill $(ps aux | grep redis-server | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PIDs of the worker processes and kill them.
subprocess.call(
[
"kill -9 $(ps aux | grep default_worker.py | "
"grep -v grep | awk '{ print $2 }') 2> /dev/null"
],
shell=True)
subprocess.call(
[
"kill -9 $(ps aux | grep ' ray_' | "
"grep -v grep | awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the Ray log monitor process and kill it.
subprocess.call(
[
"kill $(ps aux | grep log_monitor.py | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the Ray reporter process and kill it.
subprocess.call(
[
"kill $(ps aux | grep reporter.py | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)

# Find the PID of the Ray dashboard process and kill it.
subprocess.call(
[
"kill $(ps aux | grep dashboard.py | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"
],
shell=True)
processes_to_kill = [
"plasma_store_server",
"raylet",
"raylet_monitor",
"monitor.py",
"redis-server",
"default_worker.py", # Python worker.
" ray_", # Python worker.
"org.ray.runtime.runner.worker.DefaultWorker", # Java worker.
"log_monitor.py",
"reporter.py",
"dashboard.py",
]

for process in processes_to_kill:
command = ("kill $(ps aux | grep '" + process + "' | grep -v grep | " +
"awk '{ print $2 }') 2> /dev/null")
subprocess.call([command], shell=True)

# Find the PID of the jupyter process and kill it.
try:
Expand All @@ -465,6 +406,8 @@ def stop():
]
subprocess.call(
["kill -9 {} 2> /dev/null".format(" ".join(pids))], shell=True)
except ImportError:
pass
except Exception:
logger.exception("Error shutting down jupyter")

Expand Down