diff --git a/rhodecode/lib/celerypylons/commands.py b/rhodecode/lib/celerypylons/commands.py --- a/rhodecode/lib/celerypylons/commands.py +++ b/rhodecode/lib/celerypylons/commands.py @@ -1,7 +1,10 @@ +import rhodecode from rhodecode.lib.utils import BasePasterCommand, Command from celery.app import app_or_default from celery.bin import camqadm, celerybeat, celeryd, celeryev +from rhodecode.lib import str2bool + __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', 'CAMQPAdminCommand', 'CeleryEventCommand'] @@ -26,6 +29,16 @@ class CeleryCommand(BasePasterCommand): self.parser.add_option(x) def command(self): + from pylons import config + try: + CELERY_ON = str2bool(config['app_conf'].get('use_celery')) + except KeyError: + CELERY_ON = False + + if CELERY_ON == False: + raise Exception('Please enable celery_on in .ini config ' + 'file before running celeryd') + rhodecode.CELERY_ON = CELERY_ON cmd = self.celery_command(app_or_default()) return cmd.run(**vars(self.options))