Commit Graph

94 Commits

Author SHA1 Message Date
Nimisha Asthagiri
aa000c1a3d Support for rescoring a problem only if the new score is higher
TNL-5046
2016-10-20 15:08:54 -04:00
Nimisha Asthagiri
02e6925275 Update grades to use Block Structures 2016-06-23 20:22:31 -04:00
Dmitry Viskov
57a9839e4c LTI-9 - Bug with sending back grades for a non-leaf blocks on devstack 2016-03-30 03:38:21 +03:00
Sarina Canelake
8928e9ef19 Remove CallStackManager (PLAT-931) 2015-12-08 10:21:55 -05:00
utkjad
387303d364 Injecting call stack manager in CSM/CSMH,introducting @trackit,@wrapt, and refining implementation[PLAT-758] 2015-08-26 22:29:43 +00:00
Calen Pennington
aa374ca12a Make DjangoXBlockUserStateClient pass semantic tests
This required the following changes to the DjangoXBlockUserStateClient
semantics:

1) Changes get/get_many to return XBlockUserState tuples, rather
than state dictionaries or (block_key, state) tuples.
2) Raises DoesNotExist if get_history is called on an XBlock that has
had no data saved to it.
3) Returns XBlockUserState tuples as the results of get_history.
2015-08-01 08:13:25 -04:00
Calen Pennington
704ae7139a Add a subclass-implementation of the UserStateClient tests 2015-08-01 08:12:04 -04:00
Sven Marnach
3d7246ecc8 Allow masquerading as a specific user different from the logged in user. 2015-07-13 18:55:45 -07:00
David Ormsbee
79de77cf95 Optimize grading/progress page to reduce database queries (cache max scores).
The progress page did a number of things that make performance terrible for
courses with large numbers of problems, particularly if those problems are
customresponse CapaModule problems that need to be executed via codejail.

The grading code takes pains to not instantiate student state and execute the
problem code. If a student has answered the question, the max score is stored
in StudentModule. However, if the student hasn't attempted the question yet, we
have to run the problem code just to call .max_score() on it. This is necessary
in grade() if the student has answered other problems in the assignment (so we
can know what to divide by). This is always necessary to know in
progress_summary() because we list out every problem there. Code execution can
be especially slow if the problems need to invoke codejail.

To address this, we create a MaxScoresCache that will cache the max raw score
possible for every problem. We select the cache keys so that it will
automatically become invalidated when a new version of the course is published.

The fundamental assumption here is that a problem cannot have two different
max score values for two unscored students. A problem *can* score two students
differently such that they have different max scores. So Carlos can have 2/3 on
a problem, while Lyla gets 3/4. But if neither Carlos nor Lyla has ever
interacted with the problem (i.e. they're just seeing it on their progress
page), they must both see 0/4 -- it cannot be the case that Carlos sees 0/3 and
Lyla sees 0/4.

We used to load all student state into two separate FieldDataCache instances,
after which we do a bunch of individual queries for scored items. Part of this
split-up was done because of locking problems, but I think we might have gotten
overzealous with our manual transaction hammer.

In this commit, we consolidate all state access in grade() and progress()
to use one shared FieldDataCache. We also use a filter so that we only pull
back StudentModule state for things that might possibly affect the grade --
items that either have scores or have children.

Because some older XModules do work in their __init__() methods (like Video),
instantiating them takes time, particularly on large courses. This commit also
changes the code that fetches the grading_context to filter out children that
can't possibly affect the grade.

Finally, we introduce a ScoresClient that also tries to fetch score
information all at once, instead of in separate queries. Technically, we are
fetching this information redundantly, but that's because the state and score
interfaces are being teased apart as we move forward. Still, this only
amounts to one extra SQL query, and has very little impact on performance
overall.

Much thanks to @adampalay -- his hackathon work in #7168 formed the basis of
this.

https://openedx.atlassian.net/browse/CSM-17
2015-07-09 10:03:58 -04:00
Calen Pennington
c1ace04483 Merge pull request #8391 from edx/alawibaba/plat5892
First draft.
2015-06-12 12:39:38 -04:00
Calen Pennington
b9f5eef4ae Log an exception before swallowing it in a KeyValueMultiSaveError 2015-06-12 12:37:49 -04:00
Xiaolu Xiong
4f45839211 Merge pull request #8325 from beardeer/master
Merge pull request #8325 from beardeer/edx-platform
2015-06-04 11:45:15 -04:00
Xiaolu Xiong
aa1bca6b41 Change the misleading doc string (str doesn't has attr 'name' ) 2015-06-04 08:30:38 -04:00
Adam Palay
6012a34765 disable contracts that were breaking capa problems on devstack (TNL-2343) 2015-06-03 16:17:30 -04:00
Calen Pennington
122039ac58 Add __len__ to FieldDataCache 2015-05-20 15:33:31 -04:00
Calen Pennington
4625036d31 Standardize on triple double-quotes for docstrings 2015-05-20 15:33:30 -04:00
Calen Pennington
827a8f815a Improve documentation of courseware.model_data 2015-05-20 15:33:30 -04:00
Calen Pennington
bd1e9aa129 Record valid scopes when raising InvalidScopeError 2015-05-20 15:33:30 -04:00
Calen Pennington
13dc390f7a Use a specialized method to clean up DjangoKeyValueStore 2015-05-20 15:33:30 -04:00
Calen Pennington
2e06e592ca Use DjangoXBlockUserStateClient to implement UserStateCache 2015-05-20 15:33:29 -04:00
Calen Pennington
257660ed85 Move query-chunking into StudentModule and related ORM-objects 2015-05-20 15:33:29 -04:00
Calen Pennington
cacdbc35d7 Remove the ability to select_for_updates from FieldDataCache.
The only consumer of that functionality (the XQueue callback) already
does retries, so newly introduce integrity errors (due to multiple
commiters trying to update a StudentModule) won't break the XQueue
processing pipeline.
2015-05-20 15:07:29 -04:00
Calen Pennington
917ea90dc3 Inline some private methods in UserStateCache 2015-05-20 15:07:28 -04:00
Calen Pennington
57d5fa28b5 Reorder methods in UserStateCache 2015-05-20 15:07:27 -04:00
Calen Pennington
3ea74743ee Flatten DjangoOrmFieldCache methods into UserStateCache 2015-05-20 15:07:27 -04:00
Calen Pennington
8c959528bc Add a last_modified method to FieldDataCache 2015-05-20 15:07:27 -04:00
Calen Pennington
3430024d22 Add a temporary set_grade method to the FieldDataCache and UserStateCache 2015-05-20 15:07:26 -04:00
Calen Pennington
c3bb2e9b3a Use per-type cache set_many calls in FieldDataCache set_many 2015-05-20 15:07:26 -04:00
Calen Pennington
60e436c290 Push get down into per-type caches 2015-05-20 15:07:26 -04:00
Calen Pennington
407db16938 Implement per-type set methods in terms of set_many methods 2015-05-20 15:07:25 -04:00
Calen Pennington
67d66184a7 Push set_many save() calls into per-type caches 2015-05-20 15:07:25 -04:00
Calen Pennington
97c2513ed8 Push set_many object creation down into per-type caches 2015-05-20 15:07:24 -04:00
Calen Pennington
a0555d4cdc Add more documentation to DjangoOrmFieldCache 2015-05-20 15:07:24 -04:00
Calen Pennington
7a9923e289 Inline find_or_create 2015-05-20 15:07:24 -04:00
Calen Pennington
6ce7cc771a Move has logic down into per-scope caches 2015-05-20 15:07:23 -04:00
Calen Pennington
43d41d6648 Move delete logic down into per-scope caches 2015-05-20 15:07:23 -04:00
Calen Pennington
d1fae17ca2 Move the logic from find into the methods that use it 2015-05-20 15:07:23 -04:00
Calen Pennington
3bcd5ceb50 Push has down into FieldDataCache from DjangoKeyValueStore 2015-05-20 15:07:23 -04:00
Calen Pennington
9338b6a480 Push delete down into FieldDataCache from DjangoKeyValueStore 2015-05-20 15:07:22 -04:00
Calen Pennington
ebb3c906ff Push set_many down into FieldDataCache from DjangoKeyValueStore 2015-05-20 15:07:22 -04:00
Calen Pennington
951c19d789 Push get down into FieldDataCache, from DjangoKeyValueStore 2015-05-20 15:07:22 -04:00
Calen Pennington
5df3c22651 Push cache_key transformations inside the cache objects 2015-05-20 15:07:21 -04:00
Calen Pennington
29606a170d Extract common django-orm-backed-cache functionality 2015-05-20 15:07:21 -04:00
Calen Pennington
7909bee511 Stop leaking private _data members from per-scope caches 2015-05-20 15:07:21 -04:00
Calen Pennington
01cf2a3225 Store cache objects, rather than dictionaries generated by cache objects 2015-05-20 15:07:21 -04:00
Calen Pennington
21bcf55dba Extract _all_block_types and _all_usage_keys out of cache class 2015-05-20 15:07:20 -04:00
Calen Pennington
4463f71148 Separate caching for particular fields from instantiating the cache 2015-05-20 15:07:20 -04:00
Calen Pennington
0d37ec8099 Change the central cache to store at two levels: first by scope, then by cache key 2015-05-20 15:07:20 -04:00
Calen Pennington
645d2a727f Move field_object -> cache_key transformations to the scope-specific caches 2015-05-20 15:07:19 -04:00
Calen Pennington
7353d40b16 Push field_object iteration inside _retrieve_fields, and rename to _cache_fields 2015-05-20 15:07:19 -04:00