Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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
Exemple #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
Exemple #7
0
def postgresql_terminate(sig=None, frame=None):
    utils.terminate(POSTGRESQL_PIDFILE)
Exemple #8
0
def nginx_terminate(sig=None, frame=None):
    utils.terminate(NGINX_PIDFILE)
Exemple #9
0
def supervisord_terminate(sig=None, frame=None):
    utils.terminate(SUPERVISORD_PIDFILE)
Exemple #10
0
def celerybeat_terminate(sig=None, frame=None):
    utils.terminate(CELERYBEAT_PIDFILE)
Exemple #11
0
def celeryd_terminate(sig=None, frame=None):
    utils.terminate(CELERYD_PIDFILE)
Exemple #12
0
def postgresql_terminate(sig=None, frame=None):
    utils.terminate(POSTGRESQL_PIDFILE)
Exemple #13
0
def nginx_terminate(sig=None, frame=None):
    utils.terminate(NGINX_PIDFILE)
Exemple #14
0
def supervisord_terminate(sig=None, frame=None):
    utils.terminate(SUPERVISORD_PIDFILE)
Exemple #15
0
def celerybeat_terminate(sig=None, frame=None):
    utils.terminate(CELERYBEAT_PIDFILE)
Exemple #16
0
def celeryd_terminate(sig=None, frame=None):
    utils.terminate(CELERYD_PIDFILE)