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
e50d45db
Commit
e50d45db
authored
Feb 27, 2017
by
Eric Fischer
Committed by
GitHub
Feb 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14598 from edx/efischer/quick
Cleaner grades exception handling
parents
c8f7587f
715076a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
lms/djangoapps/grades/tasks.py
+15
-4
No files found.
lms/djangoapps/grades/tasks.py
View file @
e50d45db
...
...
@@ -33,7 +33,20 @@ from .transformer import GradesTransformer
log
=
getLogger
(
__name__
)
KNOWN_RETRY_ERRORS
=
(
DatabaseError
,
ValidationError
)
# Errors we expect occasionally, should be resolved on retry
class
DatabaseNotReadyError
(
IOError
):
"""
Subclass of IOError to indicate the database has not yet committed
the data we're trying to find.
"""
pass
KNOWN_RETRY_ERRORS
=
(
# Errors we expect occasionally, should be resolved on retry
DatabaseError
,
ValidationError
,
DatabaseNotReadyError
)
RECALCULATE_GRADE_DELAY
=
2
# in seconds, to prevent excessive _has_db_updated failures. See TNL-6424.
...
...
@@ -101,7 +114,7 @@ def _recalculate_subsection_grade(self, **kwargs):
has_database_updated
=
_has_db_updated_with_new_score
(
self
,
scored_block_usage_key
,
**
kwargs
)
if
not
has_database_updated
:
raise
_retry_recalculate_subsection_grade
(
self
,
**
kwargs
)
raise
DatabaseNotReadyError
_update_subsection_grades
(
course_key
,
...
...
@@ -109,8 +122,6 @@ def _recalculate_subsection_grade(self, **kwargs):
kwargs
[
'only_if_higher'
],
kwargs
[
'user_id'
],
)
except
Retry
:
raise
except
Exception
as
exc
:
# pylint: disable=broad-except
if
not
isinstance
(
exc
,
KNOWN_RETRY_ERRORS
):
log
.
info
(
"tnl-6244 grades unexpected failure: {}. task id: {}. kwargs={}"
.
format
(
...
...
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