Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b37d2d73
Commit
b37d2d73
authored
Sep 01, 2016
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make BlockStructure tasks more resilient against failures.
https://openedx.atlassian.net/browse/TNL-5041
parent
c03026c5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
cms/envs/common.py
+1
-0
lms/envs/common.py
+17
-0
openedx/core/djangoapps/content/block_structure/signals.py
+5
-1
openedx/core/djangoapps/content/block_structure/tasks.py
+5
-1
No files found.
cms/envs/common.py
View file @
b37d2d73
...
...
@@ -80,6 +80,7 @@ from lms.envs.common import (
# django-debug-toolbar
DEBUG_TOOLBAR_PATCH_SETTINGS
,
BLOCK_STRUCTURES_SETTINGS
,
)
from
path
import
Path
as
path
from
warnings
import
simplefilter
...
...
lms/envs/common.py
View file @
b37d2d73
...
...
@@ -1771,6 +1771,23 @@ CELERY_QUEUES = {
# let logging work as configured:
CELERYD_HIJACK_ROOT_LOGGER
=
False
################################ Block Structures ###################################
BLOCK_STRUCTURES_SETTINGS
=
dict
(
# Delay, in seconds, after a new edit of a course is published
# before updating the block structures cache. This is needed
# 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
,
# Delay, in seconds, between retry attempts if a task fails.
BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY
=
30
,
# Maximum number of retries per task.
BLOCK_STRUCTURES_TASK_MAX_RETRIES
=
5
,
)
################################ Bulk Email ###################################
# Suffix used to construct 'from' email address for bulk emails.
...
...
openedx/core/djangoapps/content/block_structure/signals.py
View file @
b37d2d73
"""
Signal handlers for invalidating cached data.
"""
from
django.conf
import
settings
from
django.dispatch.dispatcher
import
receiver
from
xmodule.modulestore.django
import
SignalHandler
...
...
@@ -19,7 +20,10 @@ def _listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable
# The countdown=0 kwarg ensures the call occurs after the signal emitter
# has finished all operations.
update_course_in_cache
.
apply_async
([
unicode
(
course_key
)],
countdown
=
0
)
update_course_in_cache
.
apply_async
(
[
unicode
(
course_key
)],
countdown
=
settings
.
BLOCK_STRUCTURES_SETTINGS
[
'BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY'
],
)
@receiver
(
SignalHandler
.
course_deleted
)
...
...
openedx/core/djangoapps/content/block_structure/tasks.py
View file @
b37d2d73
...
...
@@ -3,6 +3,7 @@ Asynchronous tasks related to the Course Blocks sub-application.
"""
import
logging
from
celery.task
import
task
from
django.conf
import
settings
from
opaque_keys.edx.keys
import
CourseKey
from
openedx.core.djangoapps.content.block_structure
import
api
...
...
@@ -10,7 +11,10 @@ from openedx.core.djangoapps.content.block_structure import api
log
=
logging
.
getLogger
(
'edx.celery.task'
)
@task
@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'
],
)
def
update_course_in_cache
(
course_key
):
"""
Updates the course blocks (in the database) for the specified course.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment