Changeset - b2f7d1c4e001
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2020-02-24 17:51:17
mads@kiilerich.com
celery: log an error for some deprecated config settings

dburi was dropped from templates in d34a59bfcebb1 and is no longer supported
in Celery 4.

celery.send.task.error.emails will no longer be supported in Celery 4 and was
just removed from the .ini template .

The "serialier" typo was fixed in 8169770a4f2c. It might bite people if they
keep using the wrong spelling.
1 file changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/celerypylons/__init__.py
Show inline comments
 
@@ -14,6 +14,8 @@ To make sure that the config really has 
 
mandatory settings.
 
"""
 

	
 
import logging
 

	
 
import celery
 
import tg
 

	
 
@@ -25,6 +27,16 @@ class CeleryConfig(object):
 
    CELERY_TASK_SERIALIZER = 'json'
 

	
 

	
 
desupported = set([
 
    'celery.result.dburi',
 
    'celery.result.serialier',
 
    'celery.send.task.error.emails',
 
])
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
def celery_config(config):
 
    """Return Celery config object populated from relevant settings in a config dict, such as tg.config"""
 

	
 
@@ -34,6 +46,8 @@ def celery_config(config):
 
    LIST_PARAMS = """CELERY_IMPORTS CELERY_ACCEPT_CONTENT""".split()
 

	
 
    for config_key, config_value in sorted(config.items()):
 
        if config_key in desupported and config_value:
 
            log.error('Celery configuration setting %r is no longer supported', config_key)
 
        celery_key = config_key.replace('.', '_').upper()
 
        if celery_key.split('_', 1)[0] not in PREFIXES:
 
            continue
0 comments (0 inline, 0 general)