未验证 提交 87906f04 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix yolov3 subprocess not exit (#2886)

* fix yolov3 subprocess not exit

* refine print
上级 3d878d02
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py
""" """
import os
import sys import sys
import signal import signal
import time import time
...@@ -19,7 +20,13 @@ def _reader_quit(signum, frame): ...@@ -19,7 +20,13 @@ def _reader_quit(signum, frame):
print("Reader process exit.") print("Reader process exit.")
sys.exit() sys.exit()
def _term_group(sig_num, frame):
print('pid {} terminated, terminate group '
'{}...'.format(os.getpid(), os.getpgrp()))
os.killpg(os.getpgid(os.getpid()), signal.SIGKILL)
signal.signal(signal.SIGTERM, _reader_quit) signal.signal(signal.SIGTERM, _reader_quit)
signal.signal(signal.SIGINT, _term_group)
class GeneratorEnqueuer(object): class GeneratorEnqueuer(object):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册