changeset 1672:13d6da57b0cf beta

Added explicit error message about running celeryd without enable_celery flag set to true.
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 12 Nov 2011 12:04:17 +0200
parents 428c0e42d25d
children 333b3e7c991f
files rhodecode/lib/celerypylons/commands.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/celerypylons/commands.py	Fri Nov 11 20:45:16 2011 +0200
+++ b/rhodecode/lib/celerypylons/commands.py	Sat Nov 12 12:04:17 2011 +0200
@@ -1,6 +1,8 @@
 from rhodecode.lib.utils import BasePasterCommand, Command
 from celery.app import app_or_default
 from celery.bin import camqadm, celerybeat, celeryd, celeryev
+from pylons import config
+from rhodecode.lib import str2bool
 
 __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand',
            'CAMQPAdminCommand', 'CeleryEventCommand']
@@ -26,6 +28,15 @@
             self.parser.add_option(x)
 
     def command(self):
+        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')
+
         cmd = self.celery_command(app_or_default())
         return cmd.run(**vars(self.options))