Browse Source

celeryd SIGHUP handler accidentally propagated to worker pool processes.

In combination with 7a7c44e39344789f11b5346e9cc8340f5fe4846c
this would make each child process start a new celeryd when
the terminal window was closed :/
Ask Solem 14 years ago
parent
commit
d335775246
1 changed files with 11 additions and 4 deletions
  1. 11 4
      celery/worker/__init__.py

+ 11 - 4
celery/worker/__init__.py

@@ -24,6 +24,13 @@ RUN = 0x1
 CLOSE = 0x2
 TERMINATE = 0x3
 
+WORKER_SIGRESET = frozenset(["SIGTERM",
+                             "SIGHUP",
+                             "SIGTTIN",
+                             "SIGTTOU"])
+WORKER_SIGIGNORE = frozenset(["SIGINT"])
+
+
 
 def process_initializer():
     """Initializes the process so it can be used to process tasks.
@@ -36,8 +43,8 @@ def process_initializer():
     # and the logger is left from the parent process causing a crash.
     _hijack_multiprocessing_logger()
 
-    platform.reset_signal("SIGTERM")
-    platform.ignore_signal("SIGINT")
+    map(platform.reset_signal, WORKER_SIGRESET)
+    map(platform.ignore_signal, WORKER_SIGIGNORE)
     platform.set_mp_process_title("celeryd")
 
     # This is for windows and other platforms not supporting
@@ -61,7 +68,7 @@ class WorkController(object):
     .. attribute:: concurrency
 
         The number of simultaneous processes doing work (default:
-        :const:`celery.conf.CELERYD_CONCURRENCY`)
+        ``conf.CELERYD_CONCURRENCY``)
 
     .. attribute:: loglevel
 
@@ -70,7 +77,7 @@ class WorkController(object):
     .. attribute:: logfile
 
         The logfile used, if no logfile is specified it uses ``stderr``
-        (default: :const:`celery.conf.CELERYD_LOG_FILE`).
+        (default: `celery.conf.CELERYD_LOG_FILE`).
 
     .. attribute:: embed_clockservice