This commit upgrades the version of pymongo from 2.x to 3.x, removing usages to deprecated functions usage and fixing tests where necessary.
This version of pymongo supports MongoDB 2.x all the way up to 4.2, and this ensures that the platform will be able to run on a supported MongoDB version in the next release.
There is no significant impact to this change;
it's just some general cleanup that I made while cleaning up this file..
We don't need to store these as instance variables,
since we never use them as such.
And since we've already factored out the remaining code from this
initialization method, we can drop it entirely.
We were performing this lookup multiple times in the POST handler;
this should increase speed and memory use, which has been problematic
with this feature.
I'm admittedly unclear why we decided to include a listing of _courses_
in the _users_ tab, when this listing is already available via the
_courses_ tab, which is where you'd expect to find it.
Particularly problematic here is the impact this has on page loads..
For instances with a large number of courses [1], pulling and rendering
adds a nontrivial amount of overhead and leads to longer load times.
In our case, this often leads to a page timeout. Since this is the main
landing page for the sysadmin dashboard, it presents the appearance that
the entire dashboard has crashed. In not being able to access the main
page, you can't access any of the other tabs via navigation, unless you
manually enter the URL :\
[1] ~750 courses, in one example
We've been running into OoM issues with this functionality while
executing on one of our smaller application servers.
- Sometimes this manifests by preventing the entire page from loading
(exception during the GET).
- At others, it occurs using the `Delete course from site` functionality
by breaking during the POST handler. This case is particularly
frustrating because the course actually is deleted, but looks like it
may not have been. Internally, this is because the 500 error occurs
_after_ the course has been successfully deleted, though this is
opaque to the end-user.
While this doesn't address the underlying memory issue,
it does at least allow the app to recover gracefully.
Use the course key as the primary key for storing coure import logs in
mongo, instead of the deprecated course key (this only applies to
courses imported via git_import.py).
No effort is made to migrate existing logs, since they are ephemeral.
The old line:
from path import path
produced pylint errors because of the baroque way that path.py defined
"path". We tried to get them to change how they defined it, but they
deleted the name instead: https://github.com/jaraco/path.py/issues/102
(Jason then changed his mind, but this is a better way to use path.py,
it avoids the pylint error at least.)
only require ccx-keys once
get_current_ccx will now expect a CourseKey instance as its argument, and will raise a value error if this expectation is not met.
document reason for local import
add special methods to pass attribute setting and deletion through to the wrapped modulestore
add __setattr__ and __delattr__ per code review, update __init__ to work with new methods
style change per code review
clean up context manager usage as recommended by code review
remove unused code and imports
convert modulestore type tests to use the `get_modulestore_type` api, remove unused imports
code quality: add docstrings
increase coverage for utils tests
fix bug found in testing.
increase test coverage on modulestore wrapper
code quality fixes
code-quality: ignore import error, but mark site for future consideration
remove references to middleware that were missed previously
use key apis rather than local implementation of key conversion. remove local implementationa
remove spurious test for attribute
fix test setUp to avoid unneeded flattening
code quality fixes
add security check ensuring that the coach is coach for *this* CCX.
prevent ccx/deprecated course id problems
1. do not allow ccx objects to be created if the course id is deprecated
2. filter out any ccx memberships that involve deprecated course ids (in case there are bad ccxs in the database)
Fix test failures and errors arising from incorrect code path execution
Create context manager to handle unwrapping and restoring ccx values for the modulestore wrapper, employ it throughout modulestore wrapper implementation