devstack_with_worker.py 1.02 KB
Newer Older
1
"""
2
This config file follows the devstack enviroment, but adds the
3 4 5
requirement of a celery worker running in the background to process
celery tasks.

6 7
When testing locally, run lms/cms with this settings file as well, to test queueing
of tasks onto the appropriate workers.
8

9 10 11
In two separate processes on devstack:
    paver devstack lms --settings=devstack_with_worker
    ./manage.py lms celery worker --settings=devstack_with_worker
12 13
"""

14 15
import os

16 17
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
18
# pylint: disable=wildcard-import, unused-wildcard-import
19 20 21 22
if 'BOK_CHOY_HOSTNAME' in os.environ:
    from lms.envs.devstack_docker import *
else:
    from lms.envs.devstack import *
23

24
# Require a separate celery worker
25 26 27 28
CELERY_ALWAYS_EAGER = False

# Disable transaction management because we are using a worker. Views
# that request a task and wait for the result will deadlock otherwise.
29 30
for database_name in DATABASES:
    DATABASES[database_name]['ATOMIC_REQUESTS'] = False