Quick Fix for Killing Ray Notebooks (#1563)

This commit is contained in:
Richard Liaw 2018-02-19 16:10:37 -08:00 committed by GitHub
parent ab37d0cd19
commit 73be235701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -238,8 +238,14 @@ def stop():
"awk '{ print $2 }') 2> /dev/null"], shell=True)
# Find the PID of the jupyter process and kill it.
subprocess.call(["kill $(ps aux | grep jupyter | grep -v grep | "
"awk '{ print $2 }') 2> /dev/null"], shell=True)
try:
from notebook.notebookapp import list_running_servers
pids = [str(server["pid"]) for server in list_running_servers()
if "/tmp/raylogs" in server["notebook_dir"]]
subprocess.call(["kill {} 2> /dev/null".format(
" ".join(pids))], shell=True)
except ImportError:
pass
@click.command()