Commit Graph

110 Commits

Author SHA1 Message Date
David Ormsbee
ca1f76cedb Move more tests to use bulk_operations. 2017-02-24 15:21:45 -05:00
David Ormsbee
2051c90924 Test Speedup: Isolate Modulestore Signals
There are a number of Django Signals that are on the modulestore's
SignalHandler class, such as SignalHandler.course_published. These
signals can trigger very expensive processes to occur, such as course
overview or block structures generation. Most of the time, the test
author doesn't care about these side-effects.

This commit does a few things:

* Converts the signals on SignalHandler to be instances of a new
  SwitchedSignal class, that allows signal sending to be disabled.

* Creates a SignalIsolationMixin helper similar in spirit to the
  CacheIsolationMixin, and adds it to the ModuleStoreIsolationMixin
  (and thus to ModuleStoreTestCase and SharedModuleStoreTestCase).

* Converts our various tests to use this new mechanism. In some cases,
  this means adjusting query counts downwards because they no longer
  have to account for publishing listener actions.

Modulestore generated signals are now muted by default during test runs.
Calls to send() them will result in no-ops. You can choose to enable
specific signals for a given subclass of ModuleStoreTestCase or
SharedModuleStoreTestCase by specifying an ENABLED_SIGNALS class
attribute, like the following example:

    from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

    class MyPublishTestCase(ModuleStoreTestCase):
        ENABLED_SIGNALS = ['course_published', 'pre_publish']

You should take great care when disabling signals outside of a
ModuleStoreTestCase or SharedModuleStoreTestCase, since they can leak
out into other tests. Be sure to always clean up, and never disable
signals outside of testing. Because signals are essentially process
globals, it can have a lot of unpleasant side-effects if we start
mucking around with them during live requests.

Overall, this change has cut the total test execution time for
edx-platform by a bit over a third, though we still spend a lot in
pre-test setup during our test builds.

[PERF-413]
2017-02-23 10:31:16 -05:00
Eric Fischer
06c3445609 Short-term fix for TNL-6559 task failures 2017-02-22 14:34:36 -05:00
Eric Fischer
7d82f32f5b Fix issue with test ordering
The second test here is not idempotent, so we must needs reset the
course before each test.
2017-02-17 09:48:56 -05:00
Eric Fischer
fd1ed2ce6d Remove unneeded validation on grades model
These checks are causing SQL query numbers to scale linearly with the
number of subsections being created/updated, and the errors they
check for have not been seen in prod.

TNL-6225
2017-02-17 09:48:56 -05:00
Nimisha Asthagiri
71cce9bb73 Block Transformers: distinguish between READ and WRITE versions
TNL-6522
2017-02-13 12:20:22 -05:00
Nimisha Asthagiri
7cc08399c6 Fix mongo query count for Grades API 2017-02-01 17:58:36 -05:00
Eric Fischer
6f8383199f Allow null edited_timestamp
Some old mongo courses do not have this field, and the team has opted
to allow null values rather than inserting a default. This change
affects both course and subsection grades.

TNL-6408
2017-01-30 13:19:36 -05:00
Sanford Student
dd93496f7a add task id to logging and log database exceptions
for TNL-6332, TNL-6373
2017-01-26 10:06:34 -05:00
Nimisha Asthagiri
5a9179bf00 Update has_database_updated_with_new_score to handle all block types
TNL-6331
2017-01-23 15:50:16 -05:00
Nimisha Asthagiri
adad6b2e83 Merge pull request #14293 from edx/beryl/pre-collect-grade-report
Grade Report: Reuse collected block structure
2017-01-10 13:44:24 -05:00
Nimisha Asthagiri
04d4ab0e4d Grade Report: Reuse collected block structure 2017-01-09 22:04:16 -05:00
Eric Fischer
3fd86614b0 sub_api get_score return value is a dict
This access pattern was wrong, and was causing errors in production. I've
included an additional happy-path test.
2017-01-09 11:50:18 -05:00
Eric Fischer
a7c2a3d926 Retry on all exceptions on failed subsection grade update 2017-01-09 11:50:18 -05:00
Eric Fischer
69eae7b8fb Test for missing submission score
Follow-up to this morning's change for TNL-6236
2017-01-03 14:47:23 -05:00
Nimisha Asthagiri
99e6d53939 Preload definitions when collecting block structures 2016-12-29 08:51:26 -05:00
sanfordstudent
e860205e67 Merge pull request #14191 from edx/beryl/content_library_access
Test retrieving subsection grade after losing access to block in subsection
2016-12-21 13:19:05 -05:00
Nimisha Asthagiri
d1d8d31bba Test retrieving subsection grade after losing access to block in subsection 2016-12-21 11:49:33 -05:00
Sanford Student
ac9b8fba5e context manager for course id in context 2016-12-20 15:26:05 -05:00
Eric Fischer
5a98a90eba Use timestamps in _has_database_updated_with_new_score check
Also fixes issue where ORA grades were never updated, by including
them in this check.

TNL-5994
TNL-5995
2016-12-09 13:46:34 -05:00
Sanford Student
5f2ffbe75b implementation of grading events
for TNL-5045
2016-12-07 14:47:08 -05:00
Sanford Student
44074f30a2 move course version repopulation to runtime layer
for TNL-6065
2016-12-06 10:22:13 -05:00
Nimisha Asthagiri
e87388e24c Grades cleanup before updating grade report
Remove deprecated SingleSectionGrader.  TNL-5987
Remove display_name and module_id from Scores objects
Update CourseGradeFactory.__init__ to not be user-specific
Update some callers to use CourseGrade class instead of "summary" dict
Remove no longer needed course_grades.py module.
Renamed django signal from GRADES_UPDATED to COURSE_GRADE_CHANGED
2016-11-30 12:36:25 -05:00
Sanford Student
4eb5311ece Separating problem raw score changed and problem weighted score changed signals
For TNL-5993
2016-11-30 10:15:07 -05:00
J. Cliff Dyer
5350e31667 fixup: extract some common code. 2016-11-22 15:53:30 -05:00
J. Cliff Dyer
0e2534f3ec Wrap update_or_create in transaction to allow validation after save 2016-11-22 12:12:15 -05:00
J. Cliff Dyer
86c12e67cc fixup: Error instead of correcting on invalid inputs. 2016-11-22 11:48:33 -05:00
J. Cliff Dyer
b6305a1553 Use first_attempted value from database
TNL-5930
2016-11-21 15:12:42 -05:00
Nimisha Asthagiri
a6b93f1ab7 Fix missing import due to merge conflict between parallel PRs 2016-11-18 15:05:09 -05:00
Cliff Dyer
3fcc904eae Merge pull request #13985 from edx/cdyer/grade-latency
Track grading task latency
2016-11-18 14:56:45 -05:00
Nimisha Asthagiri
47de5e6c68 Merge pull request #14021 from edx/beryl/null-subsection-error
Handle DAGs with inaccessible Subsections on Problem Score update
2016-11-18 13:57:25 -05:00
J. Cliff Dyer
210a5a4a3e Add log statement when task is first created.
TNL-5817
2016-11-18 13:35:38 -05:00
Nimisha Asthagiri
bc551b9b25 Merge pull request #14001 from edx/beryl/get-max-score-opt
Optimize max_score by moving from XModule to Descriptor
2016-11-18 11:41:55 -05:00
Nimisha Asthagiri
6e1471e442 Merge pull request #14012 from edx/beryl/unattempted-problems
Compute Attempted versus Grade of Zero
2016-11-18 11:23:30 -05:00
Nimisha Asthagiri
89d916918f Handle DAGs with inaccessible Subsections on Problem Score update
TNL-5886
2016-11-18 10:34:01 -05:00
Nimisha Asthagiri
fda2ceac8d Fix Delete-Student-State CSM entry deletion 2016-11-18 10:27:12 -05:00
Nimisha Asthagiri
7899528b52 Compute Attempted versus Grade of Zero
TNL-5953
2016-11-18 10:05:23 -05:00
Eric Fischer
6fb5eeb390 Merge pull request #13993 from edx/efischer/tnl-5471
Remove Extraneous Subsection Grade DatabaseError protection
2016-11-17 09:42:07 -05:00
sanfordstudent
dd809dfdc3 Merge pull request #13961 from edx/sstudent/TNL-5895
Add first_attempted to subsection grades data model
2016-11-15 11:41:19 -05:00
Eric Fischer
b9adb42f23 Remove Extraneous Subsection Grade DatabaseError protection
These lines are now being run in async tasks anyways, so we can remove this
decorator and rely on the async task to retry itself. Also cleans up a few
pylint violoations noticed in subsection_grade.py.

Tests have been updated to match new behavior.
2016-11-15 10:49:32 -05:00
Sanford Student
6d50044ec4 adding first attempted timestamp to subsection grades
for TNL-5895
2016-11-15 10:01:44 -05:00
Eugeny Kolpakov
4e773095c3 Merge pull request #13941 from edx/hash-update/drag-and-drop-v2
Hash update: Bumped DnDv2 to v2.0.12
2016-11-14 10:17:19 +03:00
J. Cliff Dyer
2bc35396fb Add date_passed column to PersistentCourseGrade model.
The column is populated with the current timestamp when a passing grade
is persisted for the first time.  "Passing grade" is defined as having a
non-blank value for letter_grade.

TNL-5888
2016-11-10 10:27:03 -05:00
E. Kolpakov
f6ac90e873 Bumped DnDv2 to v2.0.12 (+fixed grading test, as DnDv2 now properly participates in scoring) 2016-11-09 12:35:57 +03:00
Nimisha Asthagiri
266bfb1ab3 Optimize async grades computation
TNL-5909
2016-11-08 19:22:30 -05:00
Sanford Student
6e52fd791f fixes from robust grades bug bash
Update course grade query parameters and check scores when updating subsection grade

For TNL-5861
2016-11-08 14:16:03 -05:00
sanfordstudent
8ffc9197e8 Merge pull request #13881 from edx/efischer/tnl-5314
Dashboard Final Grade Updates
2016-11-07 16:08:06 -05:00
Sanford Student
54df702630 Dashboard final grade display uses PersistedCourseGrade
Will fall back to stored certificate grade if needed as we've discussed.

TNL-5314
2016-11-07 14:00:27 -05:00
J. Cliff Dyer
9366c43a83 Fix issues with RequestFactory used as Request.
* Centralize creation of quick request objects.
* Isolate caches to individual tests to prevent test ordering
  dependencies.

TNL-5811
2016-11-07 10:51:04 -05:00
Nimisha Asthagiri
8ae20e3812 Add grades feature check to subsection task handler. 2016-11-01 21:21:04 -04:00