def __kill_zookeeper_process(signum: int = None, frame: int = None) -> None:
    """Pass SIGINT/SIGTERM to child ZooKeeper when exiting."""
    global __zookeeper_pid
    if __zookeeper_pid is None:
        log.warning("ZooKeeper PID is unset, probably it wasn't started.")
    else:
        gracefully_kill_child_process(child_pid=__zookeeper_pid, sigkill_timeout=MC_ZOOKEEPER_SIGKILL_TIMEOUT)
    sys.exit(signum or 0)
Exemple #2
0
def __kill_solr_process(signum: int = None, frame: int = None) -> None:
    """Pass SIGINT/SIGTERM to child Solr when exiting."""
    global __solr_pid
    if __solr_pid is None:
        l.warn("Solr PID is unset, probably it wasn't started.")
    else:
        gracefully_kill_child_process(child_pid=__solr_pid, sigkill_timeout=MC_SOLR_SIGKILL_TIMEOUT)
    sys.exit(signum or 0)
Exemple #3
0
def __kill_zookeeper_process(signum: int = None, frame: int = None) -> None:
    """Pass SIGINT/SIGTERM to child ZooKeeper when exiting."""
    global __zookeeper_pid
    if __zookeeper_pid is None:
        log.warning("ZooKeeper PID is unset, probably it wasn't started.")
    else:
        gracefully_kill_child_process(child_pid=__zookeeper_pid, sigkill_timeout=MC_ZOOKEEPER_SIGKILL_TIMEOUT)
    sys.exit(signum or 0)
Exemple #4
0
def __kill_solr_process(signum: int = None, frame: int = None) -> None:
    """Pass SIGINT/SIGTERM to child Solr when exiting."""
    global __solr_pid
    if __solr_pid is None:
        l.warning("Solr PID is unset, probably it wasn't started.")
    else:
        gracefully_kill_child_process(child_pid=__solr_pid,
                                      sigkill_timeout=MC_SOLR_SIGKILL_TIMEOUT)
    sys.exit(signum or 0)
def test_gracefully_kill_child_process():
    test_process = subprocess.Popen(['sleep', '999'])
    test_process_pid = test_process.pid

    assert test_process_pid != 0
    assert test_process_pid is not None

    assert process_with_pid_is_running(test_process_pid) is True

    gracefully_kill_child_process(child_pid=test_process_pid, sigkill_timeout=3)

    test_process.communicate()
    assert process_with_pid_is_running(test_process_pid) is False