Files
@ 7e5f8c12a3fc
Branch filter:
Location: kallithea/rhodecode/lib/celerypylons/commands.py - annotation
7e5f8c12a3fc
2.9 KiB
text/x-python
First step in two-part process to rename directories to kallithea.
This first step is to change all references in the files where they refer
to the old directory name.
This first step is to change all references in the files where they refer
to the old directory name.
ffd45b185016 ffd45b185016 7e5f8c12a3fc 7e5f8c12a3fc 3a7f5b1a19dd 3a7f5b1a19dd fe8c2e881403 7e5f8c12a3fc f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd fe8c2e881403 13d6da57b0cf 13d6da57b0cf 13d6da57b0cf 13d6da57b0cf 13d6da57b0cf 7aa0ff5b4e09 ffd45b185016 13d6da57b0cf 7e5f8c12a3fc 8ecfed1d8f8b 3a7f5b1a19dd 3a7f5b1a19dd 3a7f5b1a19dd 8ecfed1d8f8b 3a7f5b1a19dd f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 3a7f5b1a19dd f6c613fba757 f6c613fba757 3a7f5b1a19dd f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 3a7f5b1a19dd f6c613fba757 f6c613fba757 3a7f5b1a19dd f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 3a7f5b1a19dd f6c613fba757 8ecfed1d8f8b 3a7f5b1a19dd 3a7f5b1a19dd f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 f6c613fba757 3a7f5b1a19dd | # -*- coding: utf-8 -*-
import kallithea
from kallithea.lib.utils import BasePasterCommand, Command, load_rcextensions
from celery.app import app_or_default
from celery.bin import camqadm, celerybeat, celeryd, celeryev
from kallithea.lib.utils2 import str2bool
__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):
from pylons import config
try:
CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
except KeyError:
CELERY_ON = False
if not CELERY_ON:
raise Exception('Please set use_celery = true in .ini config '
'file before running celeryd')
kallithea.CELERY_ON = CELERY_ON
load_rcextensions(config['here'])
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
|