Changeset - 13d6da57b0cf
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-11-12 11:04:17
marcin@python-works.com
Added explicit error message about running celeryd without enable_celery flag set to true.
1 file changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/celerypylons/commands.py
Show inline comments
 
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']
 

	
 

	
 
class CeleryCommand(BasePasterCommand):
 
@@ -23,12 +25,21 @@ class CeleryCommand(BasePasterCommand):
 

	
 
        cmd = self.celery_command(app_or_default())
 
        for x in cmd.get_options():
 
            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))
 

	
 
class CeleryDaemonCommand(CeleryCommand):
 
    """Start the celery worker
 

	
0 comments (0 inline, 0 general)