aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/celery_setup
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-05-20 18:49:04 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-05-20 18:49:04 -0500
commit571198c938d66d2cc4d7d7a0d261633d51061968 (patch)
treeee6422de85f5c781ec1f3f969af976ac00e70591 /mediagoblin/celery_setup
parent6926b23d43323bbc214aa285948ad2850c5ad22e (diff)
downloadmediagoblin-571198c938d66d2cc4d7d7a0d261633d51061968.tar.lz
mediagoblin-571198c938d66d2cc4d7d7a0d261633d51061968.tar.xz
mediagoblin-571198c938d66d2cc4d7d7a0d261633d51061968.zip
Now you can set CELERY_ALWAYS_EAGER environment variable so that you
don't have to run celeryd at the same time. This should make Elrond happy ;)
Diffstat (limited to 'mediagoblin/celery_setup')
-rw-r--r--mediagoblin/celery_setup/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mediagoblin/celery_setup/__init__.py b/mediagoblin/celery_setup/__init__.py
index 551b2741..1a77cc62 100644
--- a/mediagoblin/celery_setup/__init__.py
+++ b/mediagoblin/celery_setup/__init__.py
@@ -76,6 +76,7 @@ DEFAULT_SETTINGS_MODULE = 'mediagoblin.celery_setup.dummy_settings_module'
def setup_celery_from_config(app_config, global_config,
settings_module=DEFAULT_SETTINGS_MODULE,
+ force_celery_always_eager=False,
set_environ=True):
"""
Take a mediagoblin app config and the global config from a paste
@@ -85,6 +86,7 @@ def setup_celery_from_config(app_config, global_config,
- app_config: the application config section
- global_config: the entire paste config, all sections
- settings_module: the module to populate, as a string
+ -
- set_environ: if set, this will CELERY_CONFIG_MODULE to the
settings_module
"""
@@ -136,6 +138,9 @@ def setup_celery_from_config(app_config, global_config,
celery_imports = celery_settings.setdefault('CELERY_IMPORTS', [])
celery_imports.extend(MANDATORY_CELERY_IMPORTS)
+ if force_celery_always_eager:
+ celery_settings['CELERY_ALWAYS_EAGER'] = True
+
__import__(settings_module)
this_module = sys.modules[settings_module]