Przeglądaj źródła

Implements app.control.autoscale required by inspect autoscale. Closes #2950

Ask Solem 9 lat temu
rodzic
commit
c2c8149913
1 zmienionych plików z 9 dodań i 0 usunięć
  1. 9 0
      celery/app/control.py

+ 9 - 0
celery/app/control.py

@@ -282,6 +282,15 @@ class Control(object):
         """
         return self.broadcast('pool_shrink', {'n': n}, destination, **kwargs)
 
+    def autoscale(self, max, min, destination=None, **kwargs):
+        """Change worker(s) autoscale setting.
+
+        Supports the same arguments as :meth:`broadcast`.
+
+        """
+        return self.broadcast(
+            'autoscale', {'max': max, 'min': min}, destination, **kwargs)
+
     def broadcast(self, command, arguments=None, destination=None,
                   connection=None, reply=False, timeout=1, limit=None,
                   callback=None, channel=None, **extra_kwargs):