Browse Source

celeryd_init signal now has new "options" argument for command-line options

Ask Solem 11 years ago
parent
commit
7940f805ec
3 changed files with 8 additions and 2 deletions
  1. 2 1
      celery/apps/worker.py
  2. 1 1
      celery/signals.py
  3. 5 0
      docs/userguide/signals.rst

+ 2 - 1
celery/apps/worker.py

@@ -130,7 +130,8 @@ class Worker(WorkController):
         # this signal can be used to set up configuration for
         # workers by name.
         signals.celeryd_init.send(
-            sender=self.hostname, instance=self, conf=self.app.conf,
+            sender=self.hostname, instance=self,
+            conf=self.app.conf, options=kwargs,
         )
 
     def on_after_init(self, purge=False, no_color=None,

+ 1 - 1
celery/signals.py

@@ -45,7 +45,7 @@ task_failure = Signal(providing_args=[
 task_revoked = Signal(providing_args=[
     'request', 'terminated', 'signum', 'expired',
 ])
-celeryd_init = Signal(providing_args=['instance', 'conf'])
+celeryd_init = Signal(providing_args=['instance', 'conf', 'options'])
 celeryd_after_setup = Signal(providing_args=['instance', 'conf'])
 worker_init = Signal(providing_args=[])
 worker_process_init = Signal(providing_args=[])

+ 5 - 0
docs/userguide/signals.rst

@@ -348,6 +348,11 @@ Provides arguments:
 * conf
     The configuration of the current app.
 
+* options
+
+    Options passed to the worker from command-line arguments (including
+    defaults).
+
 .. signal:: worker_init
 
 worker_init