# HG changeset patch # User Mads Kiilerich # Date 1582041789 -3600 # Node ID 66670aff96c534f34da60b6cd75ef5b44267fca4 # Parent b1eee51194161e7795302fbad24ca1fefdd6c3e6 celery: set default config values in code and remove them from the generated .ini It is hard to imagine any reason the user should change celery.imports . And if it ever should change, we want it controlled in code - not left stale in user controlled config files. Everybody sould just use .json and there is no reason anybody should specify that in the .ini ... and it will be the default in Celery 4. diff -r b1eee5119416 -r 66670aff96c5 development.ini --- a/development.ini Sun Feb 16 04:16:14 2020 +0100 +++ b/development.ini Tue Feb 18 17:03:09 2020 +0100 @@ -255,11 +255,7 @@ ## 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 -r b1eee5119416 -r 66670aff96c5 kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py Sun Feb 16 04:16:14 2020 +0100 +++ b/kallithea/lib/celerypylons/__init__.py Tue Feb 18 17:03:09 2020 +0100 @@ -18,15 +18,16 @@ 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 -r b1eee5119416 -r 66670aff96c5 kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako Sun Feb 16 04:16:14 2020 +0100 +++ b/kallithea/lib/paster_commands/template.ini.mako Tue Feb 18 17:03:09 2020 +0100 @@ -361,11 +361,7 @@ <%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