Show More
@@ -1,6 +1,8 | |||||
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'] | |
@@ -26,6 +28,15 class CeleryCommand(BasePasterCommand): | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now