From 2f3b0b4cc84217c68767cfb1aae3081b7936e083 Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Sun, 26 Feb 2017 21:05:21 -0500 Subject: [PATCH] Storage-backed versioned Block Structures: Settings --- lms/envs/aws.py | 3 +++ lms/envs/bok_choy.py | 6 +++--- lms/envs/common.py | 11 ++++++++--- .../djangoapps/content/block_structure/signals.py | 2 +- .../core/djangoapps/content/block_structure/tasks.py | 8 ++++---- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 3331fc93bc..b0652aea82 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -597,6 +597,9 @@ BROKER_URL = "{0}://{1}:{2}@{3}/{4}".format(CELERY_BROKER_TRANSPORT, CELERY_BROKER_VHOST) BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False) +# Block Structures +BLOCK_STRUCTURES_SETTINGS = ENV_TOKENS.get('BLOCK_STRUCTURES_SETTINGS', BLOCK_STRUCTURES_SETTINGS) + # upload limits STUDENT_FILEUPLOAD_MAX_SIZE = ENV_TOKENS.get("STUDENT_FILEUPLOAD_MAX_SIZE", STUDENT_FILEUPLOAD_MAX_SIZE) diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index 910e86c131..8431c74f4c 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -80,11 +80,11 @@ BLOCK_STRUCTURES_SETTINGS = dict( # We have CELERY_ALWAYS_EAGER set to True, so there's no asynchronous # code running and the celery routing is unimportant. # It does not make sense to retry. - BLOCK_STRUCTURES_TASK_MAX_RETRIES=0, + TASK_MAX_RETRIES=0, # course publish task delay is irrelevant is because the task is run synchronously - BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY=0, + COURSE_PUBLISH_TASK_DELAY=0, # retry delay is irrelevent because we never retry - BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY=0, + TASK_DEFAULT_RETRY_DELAY=0, ) ###################### Grade Downloads ###################### diff --git a/lms/envs/common.py b/lms/envs/common.py index 5181035365..f55f4a63e4 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1805,13 +1805,18 @@ BLOCK_STRUCTURES_SETTINGS = dict( # for a better chance at getting the latest changes when there # are secondary reads in sharded mongoDB clusters. See TNL-5041 # for more info. - BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY=30, + COURSE_PUBLISH_TASK_DELAY=30, # Delay, in seconds, between retry attempts if a task fails. - BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY=30, + TASK_DEFAULT_RETRY_DELAY=30, # Maximum number of retries per task. - BLOCK_STRUCTURES_TASK_MAX_RETRIES=5, + TASK_MAX_RETRIES=5, + + # Backend storage + # STORAGE_CLASS='storages.backends.s3boto.S3BotoStorage', + # STORAGE_KWARGS=dict(bucket='nim-beryl-test'), + # DIRECTORY_PREFIX='/modeltest/', ) ################################ Bulk Email ################################### diff --git a/openedx/core/djangoapps/content/block_structure/signals.py b/openedx/core/djangoapps/content/block_structure/signals.py index 82576eb2ac..fdc010561e 100644 --- a/openedx/core/djangoapps/content/block_structure/signals.py +++ b/openedx/core/djangoapps/content/block_structure/signals.py @@ -28,7 +28,7 @@ def _listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable update_course_in_cache.apply_async( [unicode(course_key)], - countdown=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY'], + countdown=settings.BLOCK_STRUCTURES_SETTINGS['COURSE_PUBLISH_TASK_DELAY'], ) diff --git a/openedx/core/djangoapps/content/block_structure/tasks.py b/openedx/core/djangoapps/content/block_structure/tasks.py index 7a3ba994d1..3a4abbc0b5 100644 --- a/openedx/core/djangoapps/content/block_structure/tasks.py +++ b/openedx/core/djangoapps/content/block_structure/tasks.py @@ -22,8 +22,8 @@ NO_RETRY_TASKS = (XMLSyntaxError, LoncapaProblemError, UnicodeEncodeError) @task( - default_retry_delay=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY'], - max_retries=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_TASK_MAX_RETRIES'], + default_retry_delay=settings.BLOCK_STRUCTURES_SETTINGS['TASK_DEFAULT_RETRY_DELAY'], + max_retries=settings.BLOCK_STRUCTURES_SETTINGS['TASK_MAX_RETRIES'], bind=True, ) def update_course_in_cache(self, course_id): @@ -34,8 +34,8 @@ def update_course_in_cache(self, course_id): @task( - default_retry_delay=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY'], - max_retries=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_TASK_MAX_RETRIES'], + default_retry_delay=settings.BLOCK_STRUCTURES_SETTINGS['TASK_DEFAULT_RETRY_DELAY'], + max_retries=settings.BLOCK_STRUCTURES_SETTINGS['TASK_MAX_RETRIES'], bind=True, ) def get_course_in_cache(self, course_id):