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
3fcc904e
Commit
3fcc904e
authored
Nov 18, 2016
by
Cliff Dyer
Committed by
GitHub
Nov 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13985 from edx/cdyer/grade-latency
Track grading task latency
parents
47de5e6c
210a5a4a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
lms/djangoapps/grades/signals/handlers.py
+7
-1
lms/djangoapps/grades/tests/test_signals.py
+23
-0
No files found.
lms/djangoapps/grades/signals/handlers.py
View file @
3fcc904e
...
@@ -123,7 +123,7 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
...
@@ -123,7 +123,7 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
"""
"""
Handles the PROBLEM_SCORE_CHANGED signal by enqueueing a subsection update operation to occur asynchronously.
Handles the PROBLEM_SCORE_CHANGED signal by enqueueing a subsection update operation to occur asynchronously.
"""
"""
recalculate_subsection_grade
.
apply_async
(
re
sult
=
re
calculate_subsection_grade
.
apply_async
(
kwargs
=
dict
(
kwargs
=
dict
(
user_id
=
kwargs
[
'user_id'
],
user_id
=
kwargs
[
'user_id'
],
course_id
=
kwargs
[
'course_id'
],
course_id
=
kwargs
[
'course_id'
],
...
@@ -134,6 +134,12 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
...
@@ -134,6 +134,12 @@ def enqueue_subsection_update(sender, **kwargs): # pylint: disable=unused-argum
score_deleted
=
kwargs
.
get
(
'score_deleted'
,
False
),
score_deleted
=
kwargs
.
get
(
'score_deleted'
,
False
),
)
)
)
)
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
)
@receiver
(
SUBSECTION_SCORE_CHANGED
)
...
...
lms/djangoapps/grades/tests/test_signals.py
View file @
3fcc904e
...
@@ -2,15 +2,19 @@
...
@@ -2,15 +2,19 @@
Tests for the score change signals defined in the courseware models module.
Tests for the score change signals defined in the courseware models module.
"""
"""
import
re
import
ddt
import
ddt
from
django.test
import
TestCase
from
django.test
import
TestCase
from
mock
import
patch
,
MagicMock
from
mock
import
patch
,
MagicMock
from
..signals.handlers
import
(
from
..signals.handlers
import
(
enqueue_subsection_update
,
submissions_score_set_handler
,
submissions_score_set_handler
,
submissions_score_reset_handler
,
submissions_score_reset_handler
,
)
)
UUID_REGEX
=
re
.
compile
(
ur'
%(hex)
s{8}-
%(hex)
s{4}-
%(hex)
s{4}-
%(hex)
s{4}-
%(hex)
s{12}'
%
{
'hex'
:
u'[0-9a-f]'
})
SUBMISSION_SET_KWARGS
=
{
SUBMISSION_SET_KWARGS
=
{
'points_possible'
:
10
,
'points_possible'
:
10
,
...
@@ -117,3 +121,22 @@ class SubmissionSignalRelayTest(TestCase):
...
@@ -117,3 +121,22 @@ class SubmissionSignalRelayTest(TestCase):
self
.
get_user_mock
=
self
.
setup_patch
(
'lms.djangoapps.grades.signals.handlers.user_by_anonymous_id'
,
None
)
self
.
get_user_mock
=
self
.
setup_patch
(
'lms.djangoapps.grades.signals.handlers.user_by_anonymous_id'
,
None
)
handler
(
None
,
**
kwargs
)
handler
(
None
,
**
kwargs
)
self
.
signal_mock
.
assert_not_called
()
self
.
signal_mock
.
assert_not_called
()
@patch
(
'lms.djangoapps.grades.signals.handlers.log.info'
)
def
test_problem_score_changed_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'
,
)
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, usage_id:block-v1:block-key, '
u'user_id:1. Task [*UUID*]'
)
)
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