Files
edx-platform/cms/envs/bok_choy_docker.yml
Jeff Cohen f03b141f05 fix: do not clear request cache when running eager Celery tasks (#31261)
Clearing the RequestCache was intended to address memory leaks in the
celery workers. Celery worker processes will process many tasks before
they are terminated. RequestCache cleanup typically happens in the
RequestCacheMiddleware class, and middleware never executes for celery.
To get around that issue, the CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION
setting was created to clear the RequestCache after every task was
successfully completed.

This works fine when celery is running as a separate process, as it's
set up to do in production. But during development, the
CELERY_ALWAYS_EAGER setting variable is set to True, meaning that
celery tasks are run in the same thread as the Django Request. This is
meant to make debugging easier, as task failures run as part of the
request cycle and will raise exceptions that are visible to the
browser.

However, celery tasks are triggered from many different actions. That
means that the RequestCache was being cleared many times during the
course of processing a request. This led to behavior that was
potentially slower, but also incorrect–the RequestCache was getting
flushed in a way that wouldn't happen in any deployed environment
because celery would be running in separate processes there. This came
up when trying to fix an issue around extra history records being
created during problem submissions:

  https://discuss.openedx.org/t/extra-history-record-stored-on-each-problem-submission/8081

Furthermore, it's not necessary to prevent RequestCache memory leaks
when running in CELERY_AWLAYS_EAGER mode in development because the
middleware cleanup happens automatically–as everything is running as
part of the request/response cycle.

There are times in which we may want to run celery eagerly and still
clear the cache, such as testing. I have set
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION = False in all dev and test
environments that already have CELERY_ALWAYS_EAGER = True. The unit
test that specifically tests whether the request cache is getting
cleared upon completion of a celery task then overrides
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION = True even though
CELERY_ALWAYS_EAGER = True for the sake of that specific testing
purpose.
2022-11-07 11:48:39 -05:00

133 lines
6.1 KiB
YAML

# ingested bok_choy_docker.env.json
# ingested bok_choy_docker.auth.json
AWS_ACCESS_KEY_ID: ''
AWS_SECRET_ACCESS_KEY: ''
BUGS_EMAIL: bugs@example.com
BULK_EMAIL_DEFAULT_FROM_EMAIL: no-reply@example.com
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['edx.devstack.memcached:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['edx.devstack.memcached:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['edx.devstack.memcached:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['edx.devstack.memcached:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['edx.devstack.memcached:11211']
CELERY_ALWAYS_EAGER: true
CELERY_BROKER_HOSTNAME: localhost
CELERY_BROKER_PASSWORD: celery
CELERY_BROKER_TRANSPORT: amqp
CELERY_BROKER_USER: celery
CERT_QUEUE: certificates
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION: false
CMS_BASE: '** OVERRIDDEN **'
CODE_JAIL:
limits: {REALTIME: 3, VMEM: 0}
COMMENTS_SERVICE_KEY: password
COMMENTS_SERVICE_URL: http://edx.devstack.studio:4567
CONTACT_EMAIL: info@example.com
CONTENTSTORE:
DOC_STORE_CONFIG:
collection: modulestore
db: test
host: [edx.devstack.mongo]
port: 27017
ENGINE: xmodule.contentstore.mongo.MongoContentStore
OPTIONS:
db: test
host: [edx.devstack.mongo]
port: 27017
DATABASES:
default: {ENGINE: django.db.backends.mysql, HOST: edx.devstack.mysql57, NAME: edxtest,
PASSWORD: '', PORT: '3306', USER: root}
student_module_history: {ENGINE: django.db.backends.mysql, HOST: edx.devstack.mysql57,
NAME: student_module_history_test, PASSWORD: '', PORT: '3306', USER: root}
DEFAULT_FEEDBACK_EMAIL: feedback@example.com
DEFAULT_FROM_EMAIL: registration@example.com
DJFS: {aws_access_key_id: test, aws_secret_access_key: test, bucket: test, prefix: test,
type: s3fs}
DOC_STORE_CONFIG:
collection: modulestore
db: test
host: [edx.devstack.mongo]
port: 27017
EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
FEATURES: {CERTIFICATES_HTML_VIEW: true, CUSTOM_COURSES_EDX: true,
ENABLE_CONTENT_LIBRARIES: true, ENABLE_DISCUSSION_SERVICE: true, ENABLE_EXTENDED_COURSE_DETAILS: true,
ENABLE_GRADE_DOWNLOADS: true, ENABLE_SPECIAL_EXAMS: true, ENTRANCE_EXAMS: true,
MILESTONES_APP: true, PREVIEW_LMS_BASE: 'preview.localhost:8003', SHOW_HEADER_LANGUAGE_SELECTOR: true}
GITHUB_REPO_ROOT: '** OVERRIDDEN **'
GRADES_DOWNLOAD: {BUCKET: edx-grades, ROOT_PATH: /tmp/edx-s3/grades, STORAGE_TYPE: localfs}
JWT_AUTH: {JWT_PRIVATE_SIGNING_JWK: '{"e": "AQAB", "d": "HIiV7KNjcdhVbpn3KT-I9n3JPf5YbGXsCIedmPqDH1d4QhBofuAqZ9zebQuxkRUpmqtYMv0Zi6ECSUqH387GYQF_XvFUFcjQRPycISd8TH0DAKaDpGr-AYNshnKiEtQpINhcP44I1AYNPCwyoxXA1fGTtmkKChsuWea7o8kytwU5xSejvh5-jiqu2SF4GEl0BEXIAPZsgbzoPIWNxgO4_RzNnWs6nJZeszcaDD0CyezVSuH9QcI6g5QFzAC_YuykSsaaFJhZ05DocBsLczShJ9Omf6PnK9xlm26I84xrEh_7x4fVmNBg3xWTLh8qOnHqGko93A1diLRCrKHOvnpvgQ",
"n": "o5cn3ljSRi6FaDEKTn0PS-oL9EFyv1pI7dRgffQLD1qf5D6sprmYfWWokSsrWig8u2y0HChSygR6Jn5KXBqQn6FpM0dDJLnWQDRXHLl3Ey1iPYgDSmOIsIGrV9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S_ROOT_URL: '** OVERRIDDEN **'
LOCAL_LOGLEVEL: INFO
LOGGING_ENV: sandbox
LOG_DIR: '** OVERRIDDEN **'
MEDIA_URL: /media/
MKTG_URL_LINK_MAP: {}
MODULESTORE:
default:
ENGINE: xmodule.modulestore.mixed.MixedModuleStore
OPTIONS:
mappings: {}
stores:
- DOC_STORE_CONFIG:
collection: modulestore
db: test
host: [edx.devstack.mongo]
port: 27017
ENGINE: xmodule.modulestore.mongo.DraftMongoModuleStore
NAME: draft
OPTIONS:
collection: modulestore
db: test
default_class: xmodule.hidden_module.HiddenDescriptor
fs_root: '** OVERRIDDEN **'
host: [edx.devstack.mongo]
port: 27017
render_template: common.djangoapps.edxmako.shortcuts.render_to_string
- ENGINE: xmodule.modulestore.xml.XMLModuleStore
NAME: xml
OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor}
SECRET_KEY: ''
SERVER_EMAIL: devops@example.com
SESSION_COOKIE_DOMAIN: null
SITE_NAME: localhost
SOCIAL_SHARING_SETTINGS: {CUSTOM_COURSE_URLS: true}
STATIC_URL_BASE: /static/
SYSLOG_SERVER: ''
TECH_SUPPORT_EMAIL: technical@example.com
TIME_ZONE: America/New_York
WIKI_ENABLED: true
XQUEUE_INTERFACE:
basic_auth: [edx, edx]
django_auth: {password: password, username: lms}
url: http://localhost:18040
ZENDESK_API_KEY: ''
ZENDESK_USER: ''