未验证 提交 6953a22e 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix yolov3 subprocess not exit (#2887)

上级 f5ce79e8
......@@ -2,6 +2,7 @@
This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py
"""
import os
import sys
import signal
import time
......@@ -19,7 +20,13 @@ def _reader_quit(signum, frame):
print("Reader process 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.SIGINT, _term_group)
class GeneratorEnqueuer(object):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册