Ejemplo n.º 1
0
 def warn_on_HUP_handler(signum, frame):
     set_in_sighandler(True)
     try:
         safe_say('{sig} not supported: Restarting with {sig} is '
                  'unstable on this platform!'.format(sig=sig))
     finally:
         set_in_sighandler(False)
Ejemplo n.º 2
0
 def cry_handler(signum, frame):
     """Signal handler logging the stacktrace of all active threads."""
     set_in_sighandler(True)
     try:
         safe_say(cry())
     finally:
         set_in_sighandler(False)
Ejemplo n.º 3
0
 def warn_on_HUP_handler(signum, frame):
     set_in_sighandler(True)
     try:
         safe_say("%(sig)s not supported: Restarting with %(sig)s is "
                  "unstable on this platform!" % {"sig": sig})
     finally:
         set_in_sighandler(False)
Ejemplo n.º 4
0
 def warn_on_HUP_handler(signum, frame):
     set_in_sighandler(True)
     try:
         safe_say('%(sig)s not supported: Restarting with %(sig)s is '
                  'unstable on this platform!' % {'sig': sig})
     finally:
         set_in_sighandler(False)
Ejemplo n.º 5
0
 def cry_handler(*args):
     """Signal handler logging the stacktrace of all active threads."""
     set_in_sighandler(True)
     try:
         safe_say(cry())
     finally:
         set_in_sighandler(False)
Ejemplo n.º 6
0
 def warn_on_HUP_handler(*args):
     set_in_sighandler(True)
     try:
         safe_say('%(sig)s not supported: Restarting with %(sig)s is '
                  'unstable on this platform!' % {'sig': sig})
     finally:
         set_in_sighandler(False)
Ejemplo n.º 7
0
 def restart_worker_sig_handler(*args):
     """Signal handler restarting the current python program."""
     set_in_sighandler(True)
     safe_say('Restarting celeryd (%s)' % (' '.join(sys.argv), ))
     import atexit
     atexit.register(_clone_current_worker)
     from celery.worker import state
     state.should_stop = True
Ejemplo n.º 8
0
 def rdb_handler(signum, frame):
     """Signal handler setting a rdb breakpoint at the current frame."""
     set_in_sighandler(True)
     try:
         from celery.contrib import rdb
         rdb.set_trace(frame)
     finally:
         set_in_sighandler(False)
Ejemplo n.º 9
0
 def restart_worker_sig_handler(*args):
     """Signal handler restarting the current python program."""
     set_in_sighandler(True)
     safe_say('Restarting celery worker ({0})'.format(' '.join(sys.argv)))
     import atexit
     atexit.register(_reload_current_worker)
     from celery.worker import state
     state.should_stop = EX_OK
Ejemplo n.º 10
0
 def rdb_handler(signum, frame):
     """Signal handler setting a rdb breakpoint at the current frame."""
     set_in_sighandler(True)
     try:
         from celery.contrib import rdb
         rdb.set_trace(frame)
     finally:
         set_in_sighandler(False)
Ejemplo n.º 11
0
 def restart_worker_sig_handler(signum, frame):
     """Signal handler restarting the current python program."""
     set_in_sighandler(True)
     safe_say("Restarting celeryd (%s)" % (" ".join(sys.argv), ))
     pid = os.fork()
     if pid == 0:
         os.execv(sys.executable, [sys.executable] + sys.argv)
     from celery.worker import state
     state.should_stop = True
Ejemplo n.º 12
0
 def restart_worker_sig_handler(signum, frame):
     """Signal handler restarting the current python program."""
     set_in_sighandler(True)
     safe_say('Restarting celeryd (%s)' % (' '.join(sys.argv), ))
     pid = os.fork()
     if pid == 0:
         os.execv(sys.executable, [sys.executable] + sys.argv)
     from celery.worker import state
     state.should_stop = True
Ejemplo n.º 13
0
 def _handle_request(signum, frame):
     set_in_sighandler(True)
     try:
         from celery.worker import state
         if current_process()._name == "MainProcess":
             if callback:
                 callback(worker)
             safe_say("celeryd: %s shutdown (MainProcess)" % how)
         if how == "Warm":
             state.should_stop = True
         elif how == "Cold":
             state.should_terminate = True
     finally:
         set_in_sighandler(False)
Ejemplo n.º 14
0
 def _handle_request(*args):
     set_in_sighandler(True)
     try:
         from celery.worker import state
         if current_process()._name == 'MainProcess':
             if callback:
                 callback(worker)
                 safe_say('celeryd: %s shutdown (MainProcess)' % how)
         if active_thread_count() > 1:
             setattr(state, {'Warm': 'should_stop',
                             'Cold': 'should_terminate'}[how], True)
         else:
             raise exc()
     finally:
         set_in_sighandler(False)
Ejemplo n.º 15
0
 def _handle_request(signum, frame):
     set_in_sighandler(True)
     try:
         from celery.worker import state
         if current_process()._name == 'MainProcess':
             if callback:
                 callback(worker)
             safe_say('celeryd: %s shutdown (MainProcess)' % how)
         if active_thread_count() > 1:
             setattr(state, {'Warm': 'should_stop',
                             'Cold': 'should_terminate'}[how], True)
         else:
             raise exc()
     finally:
         set_in_sighandler(False)
Ejemplo n.º 16
0
    def _handle_request(*args):
        set_in_sighandler(True)
        try:
            from celery.worker import state

            if current_process()._name == "MainProcess":
                if callback:
                    callback(worker)
                    safe_say("celeryd: %s shutdown (MainProcess)" % how)
            if active_thread_count() > 1:
                setattr(state, {"Warm": "should_stop", "Cold": "should_terminate"}[how], True)
            else:
                raise exc()
        finally:
            set_in_sighandler(False)
Ejemplo n.º 17
0
 def _handle_request(signum, frame):
     set_in_sighandler(True)
     try:
         from celery.worker import state
         if current_process()._name == "MainProcess":
             if callback:
                 callback(worker)
             safe_say("celeryd: %s shutdown (MainProcess)" % how)
         if active_thread_count() > 1:
             setattr(state, {"Warm": "should_stop",
                             "Cold": "should_terminate"}[how], True)
         else:
             raise exc()
     finally:
         set_in_sighandler(False)
Ejemplo n.º 18
0
 def warn_on_HUP_handler(*args):
     set_in_sighandler(True)
     try:
         safe_say("%(sig)s not supported: Restarting with %(sig)s is " "unstable on this platform!" % {"sig": sig})
     finally:
         set_in_sighandler(False)