예제 #1
0
파일: worker.py 프로젝트: KWMalik/celery
 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)
예제 #2
0
파일: worker.py 프로젝트: rwillmer/celery
 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)
예제 #3
0
파일: worker.py 프로젝트: unixomg/celery
 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)
예제 #4
0
파일: worker.py 프로젝트: rwillmer/celery
 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)
예제 #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)
예제 #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)
예제 #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
예제 #8
0
파일: worker.py 프로젝트: unixomg/celery
 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)
예제 #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
예제 #10
0
파일: worker.py 프로젝트: rwillmer/celery
 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)
예제 #11
0
파일: worker.py 프로젝트: unixomg/celery
 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
예제 #12
0
파일: worker.py 프로젝트: rwillmer/celery
 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
예제 #13
0
파일: worker.py 프로젝트: tigrang/celery
 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)
예제 #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)
예제 #15
0
파일: worker.py 프로젝트: rwillmer/celery
 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)
예제 #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)
예제 #17
0
파일: worker.py 프로젝트: unixomg/celery
 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)
예제 #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)