Mercurial > kallithea
comparison rhodecode/lib/celerypylons/commands.py @ 2109:8ecfed1d8f8b beta
utils/conf
- created temporary utils2
- made config.conf for storing some configurations
- fixed some dependency import problems
- code cleanup
- rc-extensions now properly work for celery
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 07 Mar 2012 02:18:22 +0200 |
parents | 07e56179633e |
children | 7aa0ff5b4e09 |
comparison
equal
deleted
inserted
replaced
2108:9e377342802c | 2109:8ecfed1d8f8b |
---|---|
1 import rhodecode | 1 import rhodecode |
2 from rhodecode.lib.utils import BasePasterCommand, Command | 2 from rhodecode.lib.utils import BasePasterCommand, Command, load_rcextensions |
3 from celery.app import app_or_default | 3 from celery.app import app_or_default |
4 from celery.bin import camqadm, celerybeat, celeryd, celeryev | 4 from celery.bin import camqadm, celerybeat, celeryd, celeryev |
5 | 5 |
6 from rhodecode.lib import str2bool | 6 from rhodecode.lib.utils2 import str2bool |
7 | 7 |
8 __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', | 8 __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', |
9 'CAMQPAdminCommand', 'CeleryEventCommand'] | 9 'CAMQPAdminCommand', 'CeleryEventCommand'] |
10 | 10 |
11 | 11 |
37 | 37 |
38 if CELERY_ON == False: | 38 if CELERY_ON == False: |
39 raise Exception('Please enable celery_on in .ini config ' | 39 raise Exception('Please enable celery_on in .ini config ' |
40 'file before running celeryd') | 40 'file before running celeryd') |
41 rhodecode.CELERY_ON = CELERY_ON | 41 rhodecode.CELERY_ON = CELERY_ON |
42 load_rcextensions(config['here']) | |
42 cmd = self.celery_command(app_or_default()) | 43 cmd = self.celery_command(app_or_default()) |
43 return cmd.run(**vars(self.options)) | 44 return cmd.run(**vars(self.options)) |
45 | |
44 | 46 |
45 class CeleryDaemonCommand(CeleryCommand): | 47 class CeleryDaemonCommand(CeleryCommand): |
46 """Start the celery worker | 48 """Start the celery worker |
47 | 49 |
48 Starts the celery worker that uses a paste.deploy configuration | 50 Starts the celery worker that uses a paste.deploy configuration |
80 description = "".join(__doc__.splitlines()[2:]) | 82 description = "".join(__doc__.splitlines()[2:]) |
81 | 83 |
82 parser = Command.standard_parser(quiet=True) | 84 parser = Command.standard_parser(quiet=True) |
83 celery_command = camqadm.AMQPAdminCommand | 85 celery_command = camqadm.AMQPAdminCommand |
84 | 86 |
87 | |
85 class CeleryEventCommand(CeleryCommand): | 88 class CeleryEventCommand(CeleryCommand): |
86 """Celery event command. | 89 """Celery event command. |
87 | 90 |
88 Capture celery events. | 91 Capture celery events. |
89 """ | 92 """ |