Mercurial > kallithea
view rhodecode/lib/celerypylons/commands.py @ 1340:cbdd583f1e58 beta
reverted copy of cached instance:
CPython
changelog
total_time 39.7253162861
average on req 0.993132907152
changesets
total_time 42.5156304836
average on req 0.425156304836
Total: 546 MB
changelog
total_time 35.5851216316
average on req 0.889628040791
changesets
total_time 30.3608012199
average on req 0.303608012199
Total: 475 MB
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 15 May 2011 18:29:33 +0200 |
parents | 3a7f5b1a19dd |
children | 13d6da57b0cf |
line wrap: on
line source
from rhodecode.lib.utils import BasePasterCommand, Command from celery.app import app_or_default from celery.bin import camqadm, celerybeat, celeryd, celeryev __all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', 'CAMQPAdminCommand', 'CeleryEventCommand'] class CeleryCommand(BasePasterCommand): """Abstract class implements run methods needed for celery Starts the celery worker that uses a paste.deploy configuration file. """ def update_parser(self): """ Abstract method. Allows for the class's parser to be updated before the superclass's `run` method is called. Necessary to allow options/arguments to be passed through to the underlying celery command. """ cmd = self.celery_command(app_or_default()) for x in cmd.get_options(): self.parser.add_option(x) def command(self): cmd = self.celery_command(app_or_default()) return cmd.run(**vars(self.options)) class CeleryDaemonCommand(CeleryCommand): """Start the celery worker Starts the celery worker that uses a paste.deploy configuration file. """ usage = 'CONFIG_FILE [celeryd options...]' summary = __doc__.splitlines()[0] description = "".join(__doc__.splitlines()[2:]) parser = Command.standard_parser(quiet=True) celery_command = celeryd.WorkerCommand class CeleryBeatCommand(CeleryCommand): """Start the celery beat server Starts the celery beat server using a paste.deploy configuration file. """ usage = 'CONFIG_FILE [celerybeat options...]' summary = __doc__.splitlines()[0] description = "".join(__doc__.splitlines()[2:]) parser = Command.standard_parser(quiet=True) celery_command = celerybeat.BeatCommand class CAMQPAdminCommand(CeleryCommand): """CAMQP Admin CAMQP celery admin tool. """ usage = 'CONFIG_FILE [camqadm options...]' summary = __doc__.splitlines()[0] description = "".join(__doc__.splitlines()[2:]) parser = Command.standard_parser(quiet=True) celery_command = camqadm.AMQPAdminCommand class CeleryEventCommand(CeleryCommand): """Celery event command. Capture celery events. """ usage = 'CONFIG_FILE [celeryev options...]' summary = __doc__.splitlines()[0] description = "".join(__doc__.splitlines()[2:]) parser = Command.standard_parser(quiet=True) celery_command = celeryev.EvCommand