Explorar o código

Worker: New settings control_queue_ttl and control_queue_expires

Alan Justino %!s(int64=8) %!d(string=hai) anos
pai
achega
de47beb240
Modificáronse 4 ficheiros con 61 adicións e 0 borrados
  1. 4 0
      celery/app/control.py
  2. 4 0
      celery/app/defaults.py
  3. 39 0
      docs/userguide/configuration.rst
  4. 14 0
      docs/whatsnew-4.0.rst

+ 4 - 0
celery/app/control.py

@@ -150,6 +150,10 @@ class Control(object):
             type='fanout',
             accept=['json'],
             producer_pool=lazy(lambda: self.app.amqp.producer_pool),
+            queue_ttl=app.conf.control_queue_ttl,
+            reply_queue_ttl=app.conf.control_queue_ttl,
+            queue_expires=app.conf.control_queue_expires,
+            reply_queue_expires=app.conf.control_queue_expires,
         )
 
     @cached_property

+ 4 - 0
celery/app/defaults.py

@@ -129,6 +129,10 @@ NAMESPACES = Namespace(
         auth_provider=Option(type='string'),
         auth_kwargs=Option(type='string'),
     ),
+    control=Namespace(
+        queue_ttl=Option(300.0, type='float'),
+        queue_expires=Option(10.0, type='float'),
+    ),
     couchbase=Namespace(
         __old__=old_ns('celery_couchbase'),
 

+ 39 - 0
docs/userguide/configuration.rst

@@ -2035,6 +2035,45 @@ Message serialization format used when sending event messages.
 
     :ref:`calling-serializers`.
 
+
+.. _conf-control:
+
+Remote Control Commands
+-----------------------
+
+.. note::
+
+    To disable remote control commands see
+    the :setting:`worker_enable_remote_control` setting.
+
+.. setting:: control_queue_ttl
+
+``control_queue_ttl``
+~~~~~~~~~~~~~~~~~~~~~
+
+Default: 300.0
+
+Time in seconds, before a message in a remote control command queue
+will expire.
+
+If using the default of 300 seconds, this means that if a remote control
+command is sent and no worker picks it up within 300 seconds, the command
+is discarded.
+
+This setting also applies to remote control reply queues.
+
+.. setting:: control_queue_expires
+
+``control_queue_expires``
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Default: 10.0
+
+Time in seconds, before an unused remote control command queue is deleted
+from the broker.
+
+This setting also applies to remote control reply queues.
+
 .. _conf-logging:
 
 Logging

+ 14 - 0
docs/whatsnew-4.0.rst

@@ -1289,6 +1289,20 @@ Worker
 
     Contributed by **David Pravec**.
 
+- New settings to control remote control command queues.
+
+    - :setting:`control_queue_expires`
+
+        Set queue expiry time for both remote control command queues,
+        and remote control reply queues.
+
+    - :setting:`control_queue_ttl`
+
+        Set message time-to-live for both remote control command queues,
+        and remote control reply queues.
+
+    Contributed by **Alan Justino**.
+
 - Worker now only starts the remote control command consumer if the
   broker transport used actually supports them.