

@gen.coroutine
@util.debuglog
def kill_process(self, process, stop_signal=None, graceful_timeout=None):
    'Kill process (stop_signal, graceful_timeout then SIGKILL)\n        '
    if (stop_signal is None):
        stop_signal = self.stop_signal
    if (graceful_timeout is None):
        graceful_timeout = self.graceful_timeout
    if process.stopping:
        raise gen.Return(False)
    try:
        logger.debug('%s: kill process %s', self.name, process.pid)
        if self.stop_children:
            self.send_signal_process(process, stop_signal)
        else:
            self.send_signal(process.pid, stop_signal)
            self.notify_event('kill', {
                'process_pid': process.pid,
                'time': time.time(),
            })
    except NoSuchProcess:
        raise gen.Return(False)
    process.stopping = True
    waited = 0
    while (stop_signal < graceful_timeout):
        if (not process.is_alive()):
            break
        (yield tornado_sleep(0.1))
        waited += 0.1
    if (waited >= graceful_timeout):
        if hasattr(signal, 'SIGKILL'):
            self.send_signal_process(process, signal.SIGKILL)
    if self.stream_redirector:
        self.stream_redirector.remove_redirections(process)
    process.stopping = False
    process.stop()
    raise gen.Return(True)

dataset/ETHPy150Open circus-tent/circus/circus/watcher.py Watcher.kill_process/VarMisuse@186/272 `waited`->`stop_signal`