Explorar o código

Now runs worker.stop when hit with the TERM signal.

Ask Solem %!s(int64=15) %!d(string=hai) anos
pai
achega
54aeaf8717
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      celery/bin/celeryd.py

+ 5 - 0
celery/bin/celeryd.py

@@ -246,6 +246,11 @@ def install_worker_int_handler(worker):
 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)