Beispiel #1
0
def celerybeat(args):
    if args.command == "start":
        celerybeat_run(args)
    elif args.command == "stop":
        utils.terminate(CELERYBEAT_PIDFILE)
    elif args.command == "clean":
        utils.remove_file(CELERYBEAT_PIDFILE)
    else:
        raise ValueError("unknown command %s" % args.command)
Beispiel #2
0
def celerybeat(args):
    if args.command == "start":
        celerybeat_run(args)
    elif args.command == "stop":
        utils.terminate(CELERYBEAT_PIDFILE)
    elif args.command == "clean":
        utils.remove_file(CELERYBEAT_PIDFILE)
    else:
        raise ValueError("unknown command %s" % args.command)
Beispiel #3
0
def supervisord(args):
    if args.command == "start":
        supervisord_run(args)
    elif args.command == "stop":
        utils.terminate(SUPERVISORD_PIDFILE)
    elif args.command == "clean":
        utils.remove_file(SUPERVISORD_PIDFILE)
    elif args.command == "reload":
        utils.terminate(SUPERVISORD_PIDFILE, signal.SIGHUP)
    else:
        raise ValueError("unknown command %s" % args.command)
Beispiel #4
0
def supervisord(args):
    if args.command == "start":
        supervisord_run(args)
    elif args.command == "stop":
        utils.terminate(SUPERVISORD_PIDFILE)
    elif args.command == "clean":
        utils.remove_file(SUPERVISORD_PIDFILE)
    elif args.command == "reload":
        utils.terminate(SUPERVISORD_PIDFILE, signal.SIGHUP)
    else:
        raise ValueError("unknown command %s" % args.command)
Beispiel #5
0
def test_terminate():
    from metrique.utils import terminate, sys_call, get_pid, clear_stale_pids
    import signal

    pid_file = os.path.join(cache_dir, 'test.pid')
    sys_call('sleep 30', fork=True, pid_file=pid_file, shell=False)
    sleep(1)
    pid = get_pid(pid_file)
    running = clear_stale_pids(pid)
    assert running
    terminate(pid, sig=signal.SIGTERM)
    sleep(1)
    running = clear_stale_pids(pid)
    assert not running
    # since we didn't tell it where to find the pid_file
    # it won't be cleaned up
    assert exists(pid_file)
    # this time we point to a pid_file and it gets cleaned up
    terminate(pid_file, sig=signal.SIGTERM)
    assert not exists(pid_file)
    # invalid pids are ignored
    assert terminate(-1) is None
Beispiel #6
0
def test_terminate():
    from metrique.utils import terminate, sys_call, get_pid, clear_stale_pids
    import signal

    pid_file = os.path.join(cache_dir, 'test.pid')
    sys_call('sleep 30', fork=True, pid_file=pid_file, shell=False)
    sleep(1)
    pid = get_pid(pid_file)
    running = clear_stale_pids(pid)
    assert running
    terminate(pid, sig=signal.SIGTERM)
    sleep(1)
    running = clear_stale_pids(pid)
    assert not running
    # since we didn't tell it where to find the pid_file
    # it won't be cleaned up
    assert exists(pid_file)
    # this time we point to a pid_file and it gets cleaned up
    terminate(pid_file, sig=signal.SIGTERM)
    assert not exists(pid_file)
    # invalid pids are ignored
    assert terminate(-1) is None
Beispiel #7
0
def postgresql_terminate(sig=None, frame=None):
    utils.terminate(POSTGRESQL_PIDFILE)
Beispiel #8
0
def nginx_terminate(sig=None, frame=None):
    utils.terminate(NGINX_PIDFILE)
Beispiel #9
0
def supervisord_terminate(sig=None, frame=None):
    utils.terminate(SUPERVISORD_PIDFILE)
Beispiel #10
0
def celerybeat_terminate(sig=None, frame=None):
    utils.terminate(CELERYBEAT_PIDFILE)
Beispiel #11
0
def celeryd_terminate(sig=None, frame=None):
    utils.terminate(CELERYD_PIDFILE)
Beispiel #12
0
def postgresql_terminate(sig=None, frame=None):
    utils.terminate(POSTGRESQL_PIDFILE)
Beispiel #13
0
def nginx_terminate(sig=None, frame=None):
    utils.terminate(NGINX_PIDFILE)
Beispiel #14
0
def supervisord_terminate(sig=None, frame=None):
    utils.terminate(SUPERVISORD_PIDFILE)
Beispiel #15
0
def celerybeat_terminate(sig=None, frame=None):
    utils.terminate(CELERYBEAT_PIDFILE)
Beispiel #16
0
def celeryd_terminate(sig=None, frame=None):
    utils.terminate(CELERYD_PIDFILE)