Browse Source

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

Ask Solem 15 years ago
parent
commit
54aeaf8717
1 changed files with 5 additions and 0 deletions
  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)