Skip to content

Commit

Permalink
Removes autoscale option completely
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jun 28, 2016
1 parent a1f0433 commit 8e0ab0f
Show file tree
Hide file tree
Showing 28 changed files with 29 additions and 574 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Celery is...

Almost every part of *Celery* can be extended or used on its own,
Custom pool implementations, serializers, compression schemes, logging,
schedulers, consumers, producers, autoscalers, broker transports and much more.
schedulers, consumers, producers, broker transports and much more.

It supports...
============
Expand Down
9 changes: 0 additions & 9 deletions celery/app/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,6 @@ def pool_shrink(self, n=1, destination=None, **kwargs):
"""
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):
Expand Down
1 change: 0 additions & 1 deletion celery/app/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def __repr__(self):
worker=Namespace(
__old__=OLD_NS_WORKER,
agent=Option(None, type='string'),
autoscaler=Option('celery.worker.autoscale:Autoscaler'),
autoreloader=Option('celery.worker.autoreload:Autoreloader'),
concurrency=Option(0, type='int'),
consumer=Option('celery.worker.consumer:Consumer', type='string'),
Expand Down
3 changes: 0 additions & 3 deletions celery/apps/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ def startup_info(self):
if loader.startswith('celery.loaders'): # pragma: no cover
loader = loader[14:]
appr += ' ({0})'.format(loader)
if self.autoscale:
max, min = self.autoscale
concurrency = '{{min={0}, max={1}}}'.format(min, max)
pool = self.pool_cls
if not isinstance(pool, string_t):
pool = pool.__module__
Expand Down
5 changes: 0 additions & 5 deletions celery/bin/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ class control(_RemoteControl):
1.0, 'tell worker(s) to modify the rate limit for a task type'),
'time_limit': (
1.0, 'tell worker(s) to modify the time limit for a task type.'),
'autoscale': (1.0, 'change autoscale settings'),
'pool_grow': (1.0, 'start more pool processes'),
'pool_shrink': (1.0, 'use less pool processes'),
}
Expand All @@ -718,10 +717,6 @@ def pool_shrink(self, method, n=1, **kwargs):
"""[N=1]"""
return self.call(method, int(n), **kwargs)

def autoscale(self, method, max=None, min=None, **kwargs):
"""[max] [min]"""
return self.call(method, int(max), int(min), **kwargs)

def rate_limit(self, method, task_name, rate_limit, **kwargs):
"""<task_name> <rate_limit> (e.g. 5/s | 5/m | 5/h)>"""
return self.call(method, task_name, rate_limit, **kwargs)
Expand Down
11 changes: 0 additions & 11 deletions celery/bin/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@
completed and the child process will be replaced afterwards.
Default: no limit.
.. cmdoption:: --autoscale
Enable autoscaling by providing
max_concurrency, min_concurrency. Example::
--autoscale=10,3
(always keep 3 processes, but grow to 10 if necessary)
.. cmdoption:: --autoreload
Enable auto-reloading.
Expand Down Expand Up @@ -209,7 +200,6 @@ class worker(Command):
celery worker -A proj --concurrency=4
celery worker -A proj --concurrency=1000 -P eventlet
celery worker --autoscale=10,0
"""
doc = __MODULE_DOC__ # parse help from this too
namespace = 'worker'
Expand Down Expand Up @@ -332,7 +322,6 @@ def prepare_arguments(self, parser):
parser.add_option_group(qopts)

fopts = OptionGroup(parser, 'Features')
fopts.add_option('--autoscale')
fopts.add_option('--autoreload', action='store_true')
fopts.add_option(
'--without-gossip', action='store_true', default=False,
Expand Down
8 changes: 4 additions & 4 deletions celery/tests/app/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_pending_configuration__compat_settings_mixing_new(self):
task_default_delivery_mode=63,
worker_agent='foo:Barz',
CELERYD_CONSUMER='foo:Fooz',
CELERYD_AUTOSCALER='foo:Xuzzy',
CELERYD_POOL='foo:Xuzzy',
)
with self.assertRaises(ImproperlyConfigured):
self.assertEqual(app.conf.worker_consumer, 'foo:Fooz')
Expand All @@ -310,11 +310,11 @@ def test_pending_configuration__compat_settings_mixing_alt(self):
worker_agent='foo:Barz',
CELERYD_CONSUMER='foo:Fooz',
worker_consumer='foo:Fooz',
CELERYD_AUTOSCALER='foo:Xuzzy',
worker_autoscaler='foo:Xuzzy'
CELERYD_POOL='foo:Xuzzy',
worker_pool='foo:Xuzzy'
)
self.assertEqual(app.conf.task_always_eager, 4)
self.assertEqual(app.conf.worker_autoscaler, 'foo:Xuzzy')
self.assertEqual(app.conf.worker_pool, 'foo:Xuzzy')

def test_pending_configuration__setdefault(self):
with self.Celery(broker='foo://bar') as app:
Expand Down
5 changes: 0 additions & 5 deletions celery/tests/bin/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,6 @@ def test_pool_shrink(self):
i.pool_shrink('pool_shrink', n=2)
i.call.assert_called_with('pool_shrink', 2)

def test_autoscale(self):
i = self.control(True)
i.autoscale('autoscale', max=3, min=2)
i.call.assert_called_with('autoscale', 3, 2)

def test_rate_limit(self):
i = self.control(True)
i.rate_limit('rate_limit', 'proj.add', '1/s')
Expand Down
4 changes: 2 additions & 2 deletions celery/tests/bin/test_celeryd_detach.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ def test_parser(self):


class test_Command(AppCase):
argv = ['--autoscale=10,2', '-c', '1',
argv = ['--foobar=10,2', '-c', '1',
'--logfile=/var/log', '-lDEBUG',
'--', '.disable_rate_limits=1']

def test_parse_options(self):
x = detached_celeryd(app=self.app)
o, v, l = x.parse_options('cd', self.argv)
self.assertEqual(o.logfile, '/var/log')
self.assertEqual(l, ['--autoscale=10,2', '-c', '1',
self.assertEqual(l, ['--foobar=10,2', '-c', '1',
'-lDEBUG', '--logfile=/var/log',
'--pidfile=celeryd.pid'])
x.parse_options('cd', []) # no args
Expand Down
10 changes: 0 additions & 10 deletions celery/tests/bin/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ def test_startup_info(self, stdout, stderr):
self.assertTrue(worker.startup_info())
worker.loglevel = logging.INFO
self.assertTrue(worker.startup_info())
worker.autoscale = 13, 10
self.assertTrue(worker.startup_info())

prev_loader = self.app.loader
worker = self.Worker(app=self.app, queues='foo,bar,baz,xuzzy,do,re,mi')
Expand Down Expand Up @@ -221,14 +219,6 @@ def test_init_queues(self, stdout, stderr):
app.amqp.queues['image'],
)

@mock.stdouts
def test_autoscale_argument(self, stdout, stderr):
worker1 = self.Worker(app=self.app, autoscale='10,3')
self.assertListEqual(worker1.autoscale, [10, 3])
worker2 = self.Worker(app=self.app, autoscale='10')
self.assertListEqual(worker2.autoscale, [10, 0])
self.assert_no_logging_side_effect()

def test_include_argument(self):
worker1 = self.Worker(app=self.app, include='os')
self.assertListEqual(worker1.include, ['os'])
Expand Down
217 changes: 0 additions & 217 deletions celery/tests/worker/test_autoscale.py

This file was deleted.

Loading

0 comments on commit 8e0ab0f

Please sign in to comment.