Skip to content

Commit

Permalink
🐛(dogwood/3/fun) allow CELERY_RESULT_BACKEND configuration
Browse files Browse the repository at this point in the history
CELERY_RESULT_BACKEND was not configurable, and thus cannot be
customized for production where we use the database backend.
  • Loading branch information
jmaupetit committed Dec 6, 2019
1 parent 3f78f48 commit f2e9990
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions releases/dogwood/3/fun/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ release.
### Changed

- Switch ORA2 production backend to Swift
- Make `CELERY_RESULT_BACKEND` configurable

## [dogwood.3-fun-1.3.1] - 2019-12-04

Expand Down
27 changes: 20 additions & 7 deletions releases/dogwood/3/fun/config/cms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@
BROKER_CONNECTION_TIMEOUT = 1

# For the Result Store, use the django cache named 'celery'
CELERY_RESULT_BACKEND = "djcelery.backends.cache:CacheBackend"
CELERY_RESULT_BACKEND = config(
"CELERY_RESULT_BACKEND", default="djcelery.backends.cache:CacheBackend"
)


# When the broker is behind an ELB, use a heartbeat to refresh the
# connection and to detect if it has been dropped.
Expand Down Expand Up @@ -178,8 +181,12 @@
SESSION_REDIS_DB = config("SESSION_REDIS_DB", default=1, formatter=int)
SESSION_REDIS_PASSWORD = config("SESSION_REDIS_PASSWORD", default=None)
SESSION_REDIS_PREFIX = config("SESSION_REDIS_PREFIX", default="session")
SESSION_REDIS_SOCKET_TIMEOUT = config("SESSION_REDIS_SOCKET_TIMEOUT", default=1, formatter=int)
SESSION_REDIS_RETRY_ON_TIMEOUT = config("SESSION_REDIS_RETRY_ON_TIMEOUT", default=False, formatter=bool)
SESSION_REDIS_SOCKET_TIMEOUT = config(
"SESSION_REDIS_SOCKET_TIMEOUT", default=1, formatter=int
)
SESSION_REDIS_RETRY_ON_TIMEOUT = config(
"SESSION_REDIS_RETRY_ON_TIMEOUT", default=False, formatter=bool
)

SESSION_REDIS = config(
"SESSION_REDIS",
Expand All @@ -194,8 +201,12 @@
},
formatter=json.loads,
)
SESSION_REDIS_SENTINEL_LIST = config("SESSION_REDIS_SENTINEL_LIST", default=None, formatter=json.loads)
SESSION_REDIS_SENTINEL_MASTER_ALIAS = config("SESSION_REDIS_SENTINEL_MASTER_ALIAS", default=None)
SESSION_REDIS_SENTINEL_LIST = config(
"SESSION_REDIS_SENTINEL_LIST", default=None, formatter=json.loads
)
SESSION_REDIS_SENTINEL_MASTER_ALIAS = config(
"SESSION_REDIS_SENTINEL_MASTER_ALIAS", default=None
)

# social sharing settings
SOCIAL_SHARING_SETTINGS = config(
Expand Down Expand Up @@ -489,9 +500,11 @@
port=CELERY_BROKER_PORT,
vhost=CELERY_BROKER_VHOST,
)
# To use redis-sentinel, refer to the documenation here
# To use redis-sentinel, refer to the documenation here
# https://celery-redis-sentinel.readthedocs.io/en/latest/
BROKER_TRANSPORT_OPTIONS = config("BROKER_TRANSPORT_OPTIONS", default={}, formatter=json.loads)
BROKER_TRANSPORT_OPTIONS = config(
"BROKER_TRANSPORT_OPTIONS", default={}, formatter=json.loads
)

# Event tracking
TRACKING_BACKENDS.update(config("TRACKING_BACKENDS", default={}, formatter=json.loads))
Expand Down
26 changes: 19 additions & 7 deletions releases/dogwood/3/fun/config/lms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
BROKER_CONNECTION_TIMEOUT = 1

# For the Result Store, use the django cache named 'celery'
CELERY_RESULT_BACKEND = "djcelery.backends.cache:CacheBackend"
CELERY_RESULT_BACKEND = config(
"CELERY_RESULT_BACKEND", default="djcelery.backends.cache:CacheBackend"
)

# When the broker is behind an ELB, use a heartbeat to refresh the
# connection and to detect if it has been dropped.
Expand Down Expand Up @@ -189,8 +191,12 @@
SESSION_REDIS_DB = config("SESSION_REDIS_DB", default=1, formatter=int)
SESSION_REDIS_PASSWORD = config("SESSION_REDIS_PASSWORD", default=None)
SESSION_REDIS_PREFIX = config("SESSION_REDIS_PREFIX", default="session")
SESSION_REDIS_SOCKET_TIMEOUT = config("SESSION_REDIS_SOCKET_TIMEOUT", default=1, formatter=int)
SESSION_REDIS_RETRY_ON_TIMEOUT = config("SESSION_REDIS_RETRY_ON_TIMEOUT", default=False, formatter=bool)
SESSION_REDIS_SOCKET_TIMEOUT = config(
"SESSION_REDIS_SOCKET_TIMEOUT", default=1, formatter=int
)
SESSION_REDIS_RETRY_ON_TIMEOUT = config(
"SESSION_REDIS_RETRY_ON_TIMEOUT", default=False, formatter=bool
)

SESSION_REDIS = config(
"SESSION_REDIS",
Expand All @@ -205,8 +211,12 @@
},
formatter=json.loads,
)
SESSION_REDIS_SENTINEL_LIST = config("SESSION_REDIS_SENTINEL_LIST", default=None, formatter=json.loads)
SESSION_REDIS_SENTINEL_MASTER_ALIAS = config("SESSION_REDIS_SENTINEL_MASTER_ALIAS", default=None)
SESSION_REDIS_SENTINEL_LIST = config(
"SESSION_REDIS_SENTINEL_LIST", default=None, formatter=json.loads
)
SESSION_REDIS_SENTINEL_MASTER_ALIAS = config(
"SESSION_REDIS_SENTINEL_MASTER_ALIAS", default=None
)

REGISTRATION_EXTRA_FIELDS = config(
"REGISTRATION_EXTRA_FIELDS", default=REGISTRATION_EXTRA_FIELDS, formatter=json.loads
Expand Down Expand Up @@ -741,9 +751,11 @@
port=CELERY_BROKER_PORT,
vhost=CELERY_BROKER_VHOST,
)
# To use redis-sentinel, refer to the documenation here
# To use redis-sentinel, refer to the documenation here
# https://celery-redis-sentinel.readthedocs.io/en/latest/
BROKER_TRANSPORT_OPTIONS = config("BROKER_TRANSPORT_OPTIONS", default={}, formatter=json.loads)
BROKER_TRANSPORT_OPTIONS = config(
"BROKER_TRANSPORT_OPTIONS", default={}, formatter=json.loads
)

# upload limits
STUDENT_FILEUPLOAD_MAX_SIZE = config(
Expand Down

0 comments on commit f2e9990

Please sign in to comment.