瀏覽代碼

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

Ask Solem 15 年之前
父節點
當前提交
54aeaf8717
共有 1 個文件被更改,包括 5 次插入0 次删除
  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)