diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -255,11 +255,7 @@ use_celery = false ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq: broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost -celery.imports = kallithea.lib.celerylib.tasks -celery.accept.content = json celery.result.backend = amqp:// -celery.result.serializer = json -celery.task.serializer = json #celery.send.task.error.emails = true #celery.amqp.task.result.expires = 18000 diff --git a/kallithea/lib/celerypylons/__init__.py b/kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py +++ b/kallithea/lib/celerypylons/__init__.py @@ -18,15 +18,16 @@ import celery import tg +class CeleryConfig(object): + CELERY_IMPORTS = ['kallithea.lib.celerylib.tasks'] + CELERY_ACCEPT_CONTENT = ['json'] + CELERY_RESULT_SERIALIZER = 'json' + CELERY_TASK_SERIALIZER = 'json' + + def celery_config(config): """Return Celery config object populated from relevant settings in a config dict, such as tg.config""" - # Verify .ini file configuration has been loaded - assert config['celery.imports'] == 'kallithea.lib.celerylib.tasks', 'Kallithea Celery configuration has not been loaded' - - class CeleryConfig(object): - pass - celery_config = CeleryConfig() PREFIXES = """ADMINS BROKER CASSANDRA CELERYBEAT CELERYD CELERYMON CELERY EMAIL SERVER""".split() diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -361,11 +361,7 @@ use_celery = false <%text>## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq: broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost -celery.imports = kallithea.lib.celerylib.tasks -celery.accept.content = json celery.result.backend = amqp:// -celery.result.serializer = json -celery.task.serializer = json #celery.send.task.error.emails = true #celery.amqp.task.result.expires = 18000