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
aafd4d9c
Commit
aafd4d9c
authored
Aug 03, 2017
by
Alex Dusenbery
Committed by
Alex Dusenbery
Aug 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn down grades logging; put policy change regrade behind a waffle killswitch.
parent
d8a974b6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
35 deletions
+9
-35
lms/djangoapps/grades/config/waffle.py
+1
-0
lms/djangoapps/grades/new/course_grade_factory.py
+1
-1
lms/djangoapps/grades/signals/handlers.py
+0
-6
lms/djangoapps/grades/tasks.py
+7
-2
lms/djangoapps/grades/tests/test_new.py
+0
-4
lms/djangoapps/grades/tests/test_signals.py
+0
-22
No files found.
lms/djangoapps/grades/config/waffle.py
View file @
aafd4d9c
...
...
@@ -11,6 +11,7 @@ WAFFLE_NAMESPACE = u'grades'
WRITE_ONLY_IF_ENGAGED
=
u'write_only_if_engaged'
ASSUME_ZERO_GRADE_IF_ABSENT
=
u'assume_zero_grade_if_absent'
ESTIMATE_FIRST_ATTEMPTED
=
u'estimate_first_attempted'
DISABLE_REGRADE_ON_POLICY_CHANGE
=
u'disable_regrade_on_policy_change'
def
waffle
():
...
...
lms/djangoapps/grades/new/course_grade_factory.py
View file @
aafd4d9c
...
...
@@ -154,7 +154,7 @@ class CourseGradeFactory(object):
"""
Returns a ZeroCourseGrade object for the given user and course.
"""
log
.
info
(
u'Grades: CreateZero,
%
s, User:
%
s'
,
unicode
(
course_data
),
user
.
id
)
log
.
debug
(
u'Grades: CreateZero,
%
s, User:
%
s'
,
unicode
(
course_data
),
user
.
id
)
return
ZeroCourseGrade
(
user
,
course_data
)
@staticmethod
...
...
lms/djangoapps/grades/signals/handlers.py
View file @
aafd4d9c
...
...
@@ -230,12 +230,6 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
),
countdown
=
RECALCULATE_GRADE_DELAY
,
)
log
.
info
(
u'Grades: Request async calculation of subsection grades with args: {}. Task [{}]'
.
format
(
', '
.
join
(
'{}:{}'
.
format
(
arg
,
kwargs
[
arg
])
for
arg
in
sorted
(
kwargs
)),
getattr
(
result
,
'id'
,
'N/A'
),
)
)
@receiver
(
SUBSECTION_SCORE_CHANGED
)
...
...
lms/djangoapps/grades/tasks.py
View file @
aafd4d9c
...
...
@@ -26,7 +26,7 @@ from track.event_transaction_utils import set_event_transaction_id, set_event_tr
from
util.date_utils
import
from_timestamp
from
xmodule.modulestore.django
import
modulestore
from
.config.waffle
import
ESTIMATE_FIRST_ATTEMPTED
,
waffle
from
.config.waffle
import
ESTIMATE_FIRST_ATTEMPTED
,
DISABLE_REGRADE_ON_POLICY_CHANGE
,
waffle
from
.constants
import
ScoreDatabaseTableEnum
from
.exceptions
import
DatabaseNotReadyError
from
.new.course_grade_factory
import
CourseGradeFactory
...
...
@@ -58,6 +58,9 @@ def compute_all_grades_for_course(**kwargs):
Kicks off a series of compute_grades_for_course_v2 tasks
to cover all of the students in the course.
"""
if
waffle
()
.
is_enabled
(
DISABLE_REGRADE_ON_POLICY_CHANGE
):
log
.
debug
(
'Grades: ignoring policy change regrade due to waffle switch'
)
else
:
course_key
=
CourseKey
.
from_string
(
kwargs
.
pop
(
'course_key'
))
for
course_key_string
,
offset
,
batch_size
in
_course_task_args
(
course_key
=
course_key
,
**
kwargs
):
kwargs
.
update
({
...
...
@@ -65,7 +68,9 @@ def compute_all_grades_for_course(**kwargs):
'offset'
:
offset
,
'batch_size'
:
batch_size
,
})
compute_grades_for_course_v2
.
apply_async
(
kwargs
=
kwargs
,
routing_key
=
settings
.
POLICY_CHANGE_GRADES_ROUTING_KEY
)
compute_grades_for_course_v2
.
apply_async
(
kwargs
=
kwargs
,
routing_key
=
settings
.
POLICY_CHANGE_GRADES_ROUTING_KEY
)
@task
(
base
=
_BaseTask
,
bind
=
True
,
default_retry_delay
=
30
,
max_retries
=
1
)
...
...
lms/djangoapps/grades/tests/test_new.py
View file @
aafd4d9c
...
...
@@ -727,10 +727,6 @@ class TestCourseGradeLogging(ProblemSubmissionTestMixin, SharedModuleStoreTestCa
enabled_for_course
=
True
):
with
patch
(
'lms.djangoapps.grades.new.course_grade_factory.log'
)
as
log_mock
:
# returns Zero when no grade, with ASSUME_ZERO_GRADE_IF_ABSENT
with
waffle
()
.
override
(
ASSUME_ZERO_GRADE_IF_ABSENT
,
active
=
True
):
self
.
_create_course_grade_and_check_logging
(
grade_factory
.
create
,
log_mock
.
info
,
u'CreateZero'
)
# read, but not persisted
self
.
_create_course_grade_and_check_logging
(
grade_factory
.
create
,
log_mock
.
info
,
u'Update'
)
...
...
lms/djangoapps/grades/tests/test_signals.py
View file @
aafd4d9c
...
...
@@ -197,28 +197,6 @@ class ScoreChangedSignalRelayTest(TestCase):
expected_set_kwargs
[
'score_deleted'
]
=
False
self
.
signal_mock
.
assert_called_with
(
**
expected_set_kwargs
)
@patch
(
'lms.djangoapps.grades.signals.handlers.log.info'
)
def
test_subsection_update_logging
(
self
,
mocklog
):
enqueue_subsection_update
(
sender
=
'test'
,
user_id
=
1
,
course_id
=
u'course-v1:edX+Demo_Course+DemoX'
,
usage_id
=
u'block-v1:block-key'
,
modified
=
FROZEN_NOW_DATETIME
,
score_db_table
=
ScoreDatabaseTableEnum
.
courseware_student_module
,
)
log_statement
=
mocklog
.
call_args
[
0
][
0
]
log_statement
=
UUID_REGEX
.
sub
(
u'*UUID*'
,
log_statement
)
self
.
assertEqual
(
log_statement
,
(
u'Grades: Request async calculation of subsection grades with args: '
u'course_id:course-v1:edX+Demo_Course+DemoX, modified:{time}, '
u'score_db_table:csm, '
u'usage_id:block-v1:block-key, user_id:1. Task [*UUID*]'
)
.
format
(
time
=
FROZEN_NOW_DATETIME
)
)
@ddt.data
(
[
score_set
,
'lms.djangoapps.grades.signals.handlers.submissions_score_set_handler'
,
SUBMISSION_SET_KWARGS
],
[
score_reset
,
'lms.djangoapps.grades.signals.handlers.submissions_score_reset_handler'
,
SUBMISSION_RESET_KWARGS
]
...
...
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