From 5323c55abcebb90f0b2f03f1fc53f020df96595a Mon Sep 17 00:00:00 2001 From: Muhammad Anas <88967643+Anas12091101@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:47:54 +0500 Subject: [PATCH] fix: renamed DatabaseNotReadyError (#35390) --- lms/djangoapps/grades/exceptions.py | 6 +++--- lms/djangoapps/grades/tasks.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lms/djangoapps/grades/exceptions.py b/lms/djangoapps/grades/exceptions.py index d615f1f64d5c..db2793efaa15 100644 --- a/lms/djangoapps/grades/exceptions.py +++ b/lms/djangoapps/grades/exceptions.py @@ -3,9 +3,9 @@ """ -class DatabaseNotReadyError(IOError): +class ScoreNotFoundError(IOError): """ - Subclass of IOError to indicate the database has not yet committed - the data we're trying to find. + Subclass of IOError to indicate the staff has not yet graded the problem or + the database has not yet committed the data we're trying to find. """ pass # lint-amnesty, pylint: disable=unnecessary-pass diff --git a/lms/djangoapps/grades/tasks.py b/lms/djangoapps/grades/tasks.py index 3b504e61ebe8..9ec237274b4f 100644 --- a/lms/djangoapps/grades/tasks.py +++ b/lms/djangoapps/grades/tasks.py @@ -33,7 +33,7 @@ from .config.waffle import DISABLE_REGRADE_ON_POLICY_CHANGE from .constants import ScoreDatabaseTableEnum from .course_grade_factory import CourseGradeFactory -from .exceptions import DatabaseNotReadyError +from .exceptions import ScoreNotFoundError from .grade_utils import are_grades_frozen from .signals.signals import SUBSECTION_SCORE_CHANGED from .subsection_grade_factory import SubsectionGradeFactory @@ -45,7 +45,7 @@ KNOWN_RETRY_ERRORS = ( # Errors we expect occasionally, should be resolved on retry DatabaseError, ValidationError, - DatabaseNotReadyError, + ScoreNotFoundError, UsageKeyNotInBlockStructure, ) RECALCULATE_GRADE_DELAY_SECONDS = 2 # to prevent excessive _has_db_updated failures. See TNL-6424. @@ -239,7 +239,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 DatabaseNotReadyError + raise ScoreNotFoundError _update_subsection_grades( course_key,