Ejemplo n.º 1
0
def is_process_running(pid):
    from yabi.backend.utils import execute

    args = ["ps", "-o", "pid=", "-p", pid]
    process = execute(args)
    stdout, stderr = process.communicate(None)

    return (pid in stdout)
Ejemplo n.º 2
0
def is_process_running(pid):
    from yabi.backend.utils import execute

    args = ["ps", "-o", "pid=", "-p", pid]
    process = execute(args)
    stdout, stderr = process.communicate(None)

    return (pid in stdout)
Ejemplo n.º 3
0
def kill_process(pid, with_SIGKILL=False):
    logger.info("Killing process (SIGKILL=%s) %s", with_SIGKILL, pid)
    from yabi.backend.utils import execute

    args = ["kill"]
    if with_SIGKILL:
        args.append("-KILL")
    args.append(pid)
    process = execute(args)
    stdout, stderr = process.communicate(None)
    status = process.returncode

    if status != 0:
        logger.error("Couldn't kill process %s. STDERR:\n%s", pid, stderr)
Ejemplo n.º 4
0
def kill_process(pid, with_SIGKILL=False):
    logger.info("Killing process (SIGKILL=%s) %s", with_SIGKILL, pid)
    from yabi.backend.utils import execute

    args = ["kill"]
    if with_SIGKILL:
        args.append("-KILL")
    args.append(pid)
    process = execute(args)
    stdout, stderr = process.communicate(None)
    status = process.returncode

    if status != 0:
        logger.error("Couldn't kill process %s. STDERR:\n%s", pid, stderr)