未验证 提交 0c8c1167 编写于 作者: B Bo Zhou 提交者: GitHub

Kill process (#285)

* use kill_process

* Update utils.py
上级 91beee07
...@@ -26,7 +26,7 @@ import warnings ...@@ -26,7 +26,7 @@ import warnings
import zmq import zmq
from datetime import datetime from datetime import datetime
from parl.utils import get_ip_address, to_byte, to_str, logger, _IS_WINDOWS from parl.utils import get_ip_address, to_byte, to_str, logger, _IS_WINDOWS, kill_process
from parl.remote import remote_constants from parl.remote import remote_constants
from parl.remote.message import InitializedWorker from parl.remote.message import InitializedWorker
from parl.remote.status import WorkerStatus from parl.remote.status import WorkerStatus
...@@ -361,9 +361,7 @@ class Worker(object): ...@@ -361,9 +361,7 @@ class Worker(object):
def exit(self): def exit(self):
"""close the worker""" """close the worker"""
self.worker_is_alive = False self.worker_is_alive = False
command = ('ps aux | grep "remote/job.py.*{}"'.format( kill_process('remote/job.py.*{}'.format(self.reply_job_address))
self.reply_job_address) + " | awk '{print $2}' | xargs kill -9")
subprocess.call([command], shell=True)
def run(self): def run(self):
"""Keep running until it lost connection with the master. """Keep running until it lost connection with the master.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册