瀏覽代碼

Merge branch 'pegler/remote-control-toggle'

Ask Solem 11 年之前
父節點
當前提交
49cbce2fb9
共有 3 個文件被更改,包括 16 次插入2 次删除
  1. 1 0
      celery/app/defaults.py
  2. 5 2
      celery/worker/consumer.py
  3. 10 0
      docs/configuration.rst

+ 1 - 0
celery/app/defaults.py

@@ -113,6 +113,7 @@ NAMESPACES = {
         'DEFAULT_DELIVERY_MODE': Option(2, type='string'),
         'EAGER_PROPAGATES_EXCEPTIONS': Option(False, type='bool'),
         'ENABLE_UTC': Option(True, type='bool'),
+        'ENABLE_REMOTE_CONTROL': Option(True, type='bool'),
         'EVENT_SERIALIZER': Option('json'),
         'EVENT_QUEUE_EXPIRES': Option(None, type='float'),
         'EVENT_QUEUE_TTL': Option(None, type='float'),

+ 5 - 2
celery/worker/consumer.py

@@ -201,7 +201,7 @@ class Consumer(object):
             # so if the connection timeout is exceeded once, it can NEVER
             # connect again.
             self.app.conf.BROKER_CONNECTION_TIMEOUT = None
-
+            
         self.steps = []
         self.blueprint = self.Blueprint(
             app=self.app, on_close=self.on_close,
@@ -484,10 +484,13 @@ class Control(bootsteps.StartStopStep):
         self.start = self.box.start
         self.stop = self.box.stop
         self.shutdown = self.box.shutdown
+        
+    def include_if(self, c):
+        return c.app.conf.CELERY_ENABLE_REMOTE_CONTROL
 
 
 class Tasks(bootsteps.StartStopStep):
-    requires = (Control, )
+    requires = ()
 
     def __init__(self, c, initial_prefetch_count=2, **kwargs):
         c.task_consumer = c.qos = None

+ 10 - 0
docs/configuration.rst

@@ -1336,6 +1336,16 @@ rechecking the schedule.  Default is 1 second.
 Setting this value to 1 second means the schedulers precision will
 be 1 second. If you need near millisecond precision you can set this to 0.1.
 
+.. setting:: CELERY_ENABLE_REMOTE_CONTROL
+
+CELERY_ENABLE_REMOTE_CONTROL
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Specify if remote control of the workers is enabled.
+
+Default is :const:`True`.
+
+
 .. _conf-error-mails:
 
 Error E-Mails