From cbb695137c56710b3be2ddaf8d3a106cdc5431f9 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 7 Feb 2016 22:43:42 +0100 Subject: [PATCH] Add redis result backend support This commit changes the Celery result backend to redis as it has already been done for the webinterface and gvaldap parts of gnuviechadmin. --- gvafile/gvafile/settings.py | 12 ++++++------ requirements/base.txt | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gvafile/gvafile/settings.py b/gvafile/gvafile/settings.py index 71d43f7..c099c38 100644 --- a/gvafile/gvafile/settings.py +++ b/gvafile/gvafile/settings.py @@ -8,7 +8,7 @@ Common settings and globals. from os import environ -def get_env_setting(setting): +def get_env_variable(setting): """ Get the environment setting or return exception. @@ -27,7 +27,7 @@ def get_env_setting(setting): ########## CELERY CONFIGURATION CELERY_TIMEZONE = 'Europe/Berlin' CELERY_ENABLE_UTC = True -CELERY_RESULT_BACKEND = 'amqp' +CELERY_RESULT_BACKEND = get_env_variable('GVAFILE_RESULTS_REDIS_URL') CELERY_RESULT_PERSISTENT = True CELERY_TASK_RESULT_EXPIRES = None CELERY_ROUTES = ( @@ -36,12 +36,12 @@ CELERY_ROUTES = ( CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' -BROKER_URL = get_env_setting('GVAFILE_BROKER_URL') +BROKER_URL = get_env_variable('GVAFILE_BROKER_URL') ########## END CELERY CONFIGURATION ########## GVAFILE CONFIGURATION -GVAFILE_SFTP_DIRECTORY = get_env_setting('GVAFILE_SFTP_DIRECTORY') -GVAFILE_MAIL_DIRECTORY = get_env_setting('GVAFILE_MAIL_DIRECTORY') -GVAFILE_SFTP_AUTHKEYS_DIRECTORY = get_env_setting( +GVAFILE_SFTP_DIRECTORY = get_env_variable('GVAFILE_SFTP_DIRECTORY') +GVAFILE_MAIL_DIRECTORY = get_env_variable('GVAFILE_MAIL_DIRECTORY') +GVAFILE_SFTP_AUTHKEYS_DIRECTORY = get_env_variable( 'GVAFILE_SFTP_AUTHKEYS_DIRECTORY') ########## END GVAFILE CONFIGURATION diff --git a/requirements/base.txt b/requirements/base.txt index 9db1684..a932d8a 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,3 +6,4 @@ kombu==3.0.33 pytz==2015.7 PyYAML==3.11 -e git+https://git.gnuviech-server.de/gvacommon.git@0.3.0#egg=gvacommon +redis==2.10.5