comparison rhodecode/lib/celerypylons/commands.py @ 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 3a7f5b1a19dd
children fe8c2e881403
comparison
equal deleted inserted replaced
1671:428c0e42d25d 1672:13d6da57b0cf
1 from rhodecode.lib.utils import BasePasterCommand, Command 1 from rhodecode.lib.utils import BasePasterCommand, Command
2 from celery.app import app_or_default 2 from celery.app import app_or_default
3 from celery.bin import camqadm, celerybeat, celeryd, celeryev 3 from celery.bin import camqadm, celerybeat, celeryd, celeryev
4 from pylons import config
5 from rhodecode.lib import str2bool
4 6
5 __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', 7 __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand',
6 'CAMQPAdminCommand', 'CeleryEventCommand'] 8 'CAMQPAdminCommand', 'CeleryEventCommand']
7 9
8 10
24 cmd = self.celery_command(app_or_default()) 26 cmd = self.celery_command(app_or_default())
25 for x in cmd.get_options(): 27 for x in cmd.get_options():
26 self.parser.add_option(x) 28 self.parser.add_option(x)
27 29
28 def command(self): 30 def command(self):
31 try:
32 CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
33 except KeyError:
34 CELERY_ON = False
35
36 if CELERY_ON == False:
37 raise Exception('Please enable celery_on in .ini config '
38 'file before running celeryd')
39
29 cmd = self.celery_command(app_or_default()) 40 cmd = self.celery_command(app_or_default())
30 return cmd.run(**vars(self.options)) 41 return cmd.run(**vars(self.options))
31 42
32 class CeleryDaemonCommand(CeleryCommand): 43 class CeleryDaemonCommand(CeleryCommand):
33 """Start the celery worker 44 """Start the celery worker