From e629cde0b361be477c5d27cf170fef9eef1d42fe Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 25 Feb 2012 22:39:08 -0600 Subject: [PATCH] Should be all that's needed to switch celery/kombu settings to sqlalchemy --- mediagoblin/config_spec.ini | 8 ++++++++ mediagoblin/init/celery/__init__.py | 23 +++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini index 2b4ba2f9..1fd56226 100644 --- a/mediagoblin/config_spec.ini +++ b/mediagoblin/config_spec.ini @@ -79,6 +79,14 @@ lock_dir = string(default="%(here)s/user_dev/beaker/cache/lock") [celery] +# default result stuff +celery_result_backend = string(default="database") +celery_result_dburi = string(default="sqlite://%(here)s/user_dev/celery.db") + +# default kombu stuff +broker_transport = string(default="database") +broker_host = string(default="sqlite://%(here)s/user_dev/celery.db") + # known booleans celery_result_persistent = boolean() celery_create_missing_queues = boolean() diff --git a/mediagoblin/init/celery/__init__.py b/mediagoblin/init/celery/__init__.py index fb958909..6dcea239 100644 --- a/mediagoblin/init/celery/__init__.py +++ b/mediagoblin/init/celery/__init__.py @@ -47,30 +47,13 @@ def setup_celery_from_config(app_config, global_config, celery_settings = {} - # set up mongodb stuff - celery_settings['CELERY_RESULT_BACKEND'] = 'mongodb' - if 'BROKER_BACKEND' not in celery_settings: - celery_settings['BROKER_BACKEND'] = 'mongodb' - - celery_mongo_settings = {} - - if 'db_host' in app_config: - celery_mongo_settings['host'] = app_config['db_host'] - if celery_settings['BROKER_BACKEND'] == 'mongodb': - celery_settings['BROKER_HOST'] = app_config['db_host'] - if 'db_port' in app_config: - celery_mongo_settings['port'] = app_config['db_port'] - if celery_settings['BROKER_BACKEND'] == 'mongodb': - celery_settings['BROKER_PORT'] = app_config['db_port'] - celery_mongo_settings['database'] = app_config['db_name'] - - celery_settings['CELERY_MONGODB_BACKEND_SETTINGS'] = celery_mongo_settings - - # Add anything else + # Add all celery settings from config for key, value in celery_conf.iteritems(): key = key.upper() celery_settings[key] = value + # TODO: use default result stuff here if it exists + # add mandatory celery imports celery_imports = celery_settings.setdefault('CELERY_IMPORTS', []) celery_imports.extend(MANDATORY_CELERY_IMPORTS) -- 2.25.1