예제 #1
0
def install_HUP_not_supported_handler(worker):

    def warn_on_HUP_handler(signum, frame):
        worker.logger.error("SIGHUP not supported: "
            "Restarting with HUP is unstable on this platform!")

    platform.install_signal_handler("SIGHUP", warn_on_HUP_handler)
예제 #2
0
def install_HUP_not_supported_handler(worker):
    def warn_on_HUP_handler(signum, frame):
        worker.logger.error(
            "SIGHUP not supported: "
            "Restarting with HUP is unstable on this platform!")

    platform.install_signal_handler("SIGHUP", warn_on_HUP_handler)
예제 #3
0
파일: celeryd.py 프로젝트: kmike/celery
def install_worker_restart_handler(worker):
    def restart_worker_sig_handler(signum, frame):
        """Signal handler restarting the current python program."""
        worker.logger.warn("Restarting celeryd (%s)" % (" ".join(sys.argv)))
        worker.stop()
        os.execv(sys.executable, [sys.executable] + sys.argv)

    platform.install_signal_handler("SIGHUP", restart_worker_sig_handler)
예제 #4
0
def install_worker_restart_handler(worker):
    def restart_worker_sig_handler(signum, frame):
        """Signal handler restarting the current python program."""
        worker.logger.warn("Restarting celeryd (%s)" % (" ".join(sys.argv)))
        worker.stop()
        os.execv(sys.executable, [sys.executable] + sys.argv)

    platform.install_signal_handler("SIGHUP", restart_worker_sig_handler)
예제 #5
0
파일: celeryd.py 프로젝트: kmike/celery
def install_worker_term_handler(worker):
    def _stop(signum, frame):
        process_name = multiprocessing.current_process().name
        if process_name == "MainProcess":
            worker.logger.warn("celeryd: Warm shutdown (%s)" % (process_name))
            worker.stop()
        raise SystemExit()

    platform.install_signal_handler("SIGTERM", _stop)
    def install_sync_handler(self, beat):
        """Install a ``SIGTERM`` + ``SIGINT`` handler that saves
        the celerybeat schedule."""
        def _sync(signum, frame):
            beat.sync()
            raise SystemExit()

        platform.install_signal_handler("SIGTERM", _sync)
        platform.install_signal_handler("SIGINT", _sync)
예제 #7
0
def install_worker_term_handler(worker):
    def _stop(signum, frame):
        process_name = multiprocessing.current_process().name
        if process_name == "MainProcess":
            worker.logger.warn("celeryd: Warm shutdown (%s)" % (process_name))
            worker.stop()
        raise SystemExit()

    platform.install_signal_handler("SIGTERM", _stop)
예제 #8
0
def install_worker_int_again_handler(worker):
    def _stop(signum, frame):
        process_name = multiprocessing.current_process().name
        if process_name == "MainProcess":
            worker.logger.warn("celeryd: Cold shutdown (%s)" % (process_name))
            worker.terminate()
        raise SystemExit()

    platform.install_signal_handler("SIGINT", _stop)
예제 #9
0
파일: celerybeat.py 프로젝트: runeh/celery
    def install_sync_handler(self, beat):
        """Install a ``SIGTERM`` + ``SIGINT`` handler that saves
        the celerybeat schedule."""

        def _sync(signum, frame):
            beat.sync()
            raise SystemExit()

        platform.install_signal_handler("SIGTERM", _sync)
        platform.install_signal_handler("SIGINT", _sync)
예제 #10
0
def install_worker_term_handler(worker):

    def _stop(signum, frame):
        if current_process().name == 'MainProcess':
            worker.logger.warn("Stopping celeryd (%s)" % \
                               (current_process().name))
            worker.stop()
        raise SystemExit()

    platform.install_signal_handler("SIGTERM", _stop)
예제 #11
0
파일: celeryd.py 프로젝트: adamend/celery
def install_worker_int_handler(worker):

    def _stop(signum, frame):
        if multiprocessing.current_process().name == 'MainProcess':
            worker.logger.warn("celeryd: Cold shutdown (%s)" % \
                               (current_process().name))
            worker.terminate()
        raise SystemExit()

    platform.install_signal_handler("SIGINT", _stop)
예제 #12
0
def install_worker_int_handler(worker):
    def _stop(signum, frame):
        process_name = multiprocessing.current_process().name
        if process_name == "MainProcess":
            worker.logger.warn("celeryd: Hitting Ctrl+C again will terminate "
                               "all running tasks!")
            install_worker_int_again_handler(worker)
            worker.logger.warn("celeryd: Warm shutdown (%s)" % (process_name))
            worker.stop()
        raise SystemExit()

    platform.install_signal_handler("SIGINT", _stop)
예제 #13
0
def install_worker_int_handler(worker):

    def _stop(signum, frame):
        process_name = multiprocessing.current_process().name
        if process_name == "MainProcess":
            worker.logger.warn(
                "celeryd: Hitting Ctrl+C again will terminate "
                "all running tasks!")
            install_worker_int_again_handler(worker)
            worker.logger.warn("celeryd: Warm shutdown (%s)" % (
                process_name))
            worker.stop()
        raise SystemExit()

    platform.install_signal_handler("SIGINT", _stop)
예제 #14
0
파일: celeryd.py 프로젝트: sverrejoh/celery
def install_worker_restart_handler(worker):

    def restart_worker_sig_handler(signum, frame):
        """Signal handler restarting the current python program."""
        worker.logger.info("Restarting celeryd (%s)" % (
            " ".join(sys.argv)))
        if worker.is_detached:
            pid = os.fork()
            if pid:
                worker.stop()
                sys.exit(0)
        else:
            worker.stop()
        os.execv(sys.executable, [sys.executable] + sys.argv)

    platform.install_signal_handler("SIGHUP", restart_worker_sig_handler)
예제 #15
0
파일: celeryd.py 프로젝트: adamend/celery
def install_worker_term_handler(worker):

    def _stop(signum, frame):
        raise SystemExit()

    platform.install_signal_handler("SIGTERM", _stop)