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
d4df4268
Commit
d4df4268
authored
Jan 26, 2017
by
Eric Fischer
Committed by
GitHub
Jan 26, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14381 from edx/efischer/xml_cache_logging
Log course on no-retry update_course_in_cache errors
parents
36d454fe
0dd61789
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
openedx/core/djangoapps/content/block_structure/tasks.py
+13
-5
No files found.
openedx/core/djangoapps/content/block_structure/tasks.py
View file @
d4df4268
...
...
@@ -24,26 +24,28 @@ 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'
],
bind
=
True
,
)
def
update_course_in_cache
(
course_id
):
def
update_course_in_cache
(
self
,
course_id
):
"""
Updates the course blocks (in the database) for the specified course.
"""
_call_and_retry_if_needed
(
course_id
,
api
.
update_course_in_cache
,
update_course_in_cache
)
_call_and_retry_if_needed
(
course_id
,
api
.
update_course_in_cache
,
update_course_in_cache
,
self
.
request
.
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'
],
bind
=
True
,
)
def
get_course_in_cache
(
course_id
):
def
get_course_in_cache
(
self
,
course_id
):
"""
Gets the course blocks for the specified course, updating the cache if needed.
"""
_call_and_retry_if_needed
(
course_id
,
api
.
get_course_in_cache
,
get_course_in_cache
)
_call_and_retry_if_needed
(
course_id
,
api
.
get_course_in_cache
,
get_course_in_cache
,
self
.
request
.
id
)
def
_call_and_retry_if_needed
(
course_id
,
api_method
,
task_method
):
def
_call_and_retry_if_needed
(
course_id
,
api_method
,
task_method
,
task_id
):
"""
Calls the given api_method with the given course_id, retrying task_method upon failure.
"""
...
...
@@ -52,6 +54,12 @@ def _call_and_retry_if_needed(course_id, api_method, task_method):
api_method
(
course_key
)
except
NO_RETRY_TASKS
as
exc
:
# Known unrecoverable errors
log
.
exception
(
"update_course_in_cache encountered unrecoverable error in course {}, task_id {}"
.
format
(
course_id
,
task_id
)
)
raise
except
RETRY_TASKS
as
exc
:
log
.
exception
(
"
%
s encountered expected error, retrying."
,
task_method
.
__name__
)
...
...
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