Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/celery_backend/config.py
Show All 24 Lines | |||||
from swh.core.logger import JournalHandler | from swh.core.logger import JournalHandler | ||||
DEFAULT_CONFIG_NAME = 'worker' | DEFAULT_CONFIG_NAME = 'worker' | ||||
CONFIG_NAME_ENVVAR = 'SWH_WORKER_INSTANCE' | CONFIG_NAME_ENVVAR = 'SWH_WORKER_INSTANCE' | ||||
CONFIG_NAME_TEMPLATE = 'worker/%s' | CONFIG_NAME_TEMPLATE = 'worker/%s' | ||||
DEFAULT_CONFIG = { | DEFAULT_CONFIG = { | ||||
'task_broker': ('str', 'amqp://guest@localhost//'), | 'task_broker': ('str', 'amqp://guest@localhost//'), | ||||
'result_backend': ('str', 'rpc://'), | |||||
'task_modules': ('list[str]', []), | 'task_modules': ('list[str]', []), | ||||
'task_queues': ('list[str]', []), | 'task_queues': ('list[str]', []), | ||||
'task_soft_time_limit': ('int', 0), | 'task_soft_time_limit': ('int', 0), | ||||
} | } | ||||
@setup_logging.connect | @setup_logging.connect | ||||
def setup_log_handler(loglevel=None, logfile=None, format=None, | def setup_log_handler(loglevel=None, logfile=None, format=None, | ||||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | CELERY_DEFAULT_CONFIG = dict( | ||||
# Send events | # Send events | ||||
worker_send_task_events=True, | worker_send_task_events=True, | ||||
# Do not send useless task_sent events | # Do not send useless task_sent events | ||||
task_send_sent_event=False, | task_send_sent_event=False, | ||||
) | ) | ||||
# Instantiate the Celery app | # Instantiate the Celery app | ||||
app = Celery(broker=CONFIG['task_broker'], | app = Celery(broker=CONFIG['task_broker'], | ||||
backend=CONFIG['result_backend'], | |||||
task_cls='swh.scheduler.task:SWHTask') | task_cls='swh.scheduler.task:SWHTask') | ||||
app.add_defaults(CELERY_DEFAULT_CONFIG) | app.add_defaults(CELERY_DEFAULT_CONFIG) | ||||
# XXX for BW compat | # XXX for BW compat | ||||
Celery.get_queue_length = get_queue_length | Celery.get_queue_length = get_queue_length |