Commit Graph

98 Commits

Author SHA1 Message Date
Calen Pennington
829227ade3 Merge pull request #19663 from cpennington/fbe-improve-course-api-performance
Fbe improve course api performance
2019-02-06 11:01:25 -05:00
Calen Pennington
43d975a92a Select related CourseOverview.image_set when loading the course_api 2019-02-06 10:11:16 -05:00
Calen Pennington
419657d7a5 Prefetch course modes used in has_access calls in course api 2019-02-06 10:11:15 -05:00
Calen Pennington
6d22866e78 Cache org-site lookups in the RequestCache 2019-02-06 10:11:15 -05:00
Calen Pennington
6c596f7c49 Allow courses api to return data incrementally
Prior to this commit, the course api (/api/courses/v1/courses/)
performed all the work necessary to return all courses available
to the user, and then only actually returned on page's worth of those
courses.

With this change, the api now does the work incrementally, computing
only the data needed to fetch the courses up to and including the page
being returned. This still increases approximately linearly as
the page number accessed being increases, but should be more cache-friendly.
One side effect of this is that the max_page reported by pagination
will be an overestimate (it will include pages that are removed due
to a users access restrictions).

This change also changes the sort-order of courses being returned by the
course_api. By sorting by course-id, rather than course-number, we
can sort in the database, rather than in Python, and defer loading data
from the end of the list until it is requested.

REVMI-90
2019-02-06 10:11:15 -05:00
Calen Pennington
9ff9c33f59 Add a test that shows how bad course api query counts are 2019-02-06 10:11:15 -05:00
Matthew Piatetsky
6e81c84d8b fix unicode strings in lms/ part 1 2019-02-05 15:15:02 -05:00
Calen Pennington
805f32a357 Revert "Allow courses api to return data incrementally" 2019-01-25 12:56:57 -05:00
Calen Pennington
2527efd822 Prefetch CourseOverview.image_set when loading the course_api 2019-01-25 10:30:09 -05:00
Calen Pennington
0d273e9506 Prefetch course modes used in has_access calls in course api 2019-01-25 10:30:09 -05:00
Calen Pennington
a842921e1f Cache org-site lookups in the RequestCache 2019-01-25 10:30:09 -05:00
Calen Pennington
a3541d6e46 Allow courses api to return data incrementally
Prior to this commit, the course api (/api/courses/v1/courses/)
performed all the work necessary to return all courses available
to the user, and then only actually returned on page's worth of those
courses.

With this change, the api now does the work incrementally, computing
only the data needed to fetch the courses up to and including the page
being returned. This still increases approximately linearly as
the page number accessed being increases, but should be more cache-friendly.
One side effect of this is that the max_page reported by pagination
will be an overestimate (it will include pages that are removed due
to a users access restrictions).

This change also changes the sort-order of courses being returned by the
course_api. By sorting by course-id, rather than course-number, we
can sort in the database, rather than in Python, and defer loading data
from the end of the list until it is requested.

REVMI-90
2019-01-25 10:30:09 -05:00
Calen Pennington
ee75db2703 Add a test that shows how bad course api query counts are 2019-01-24 22:54:01 -05:00
Jeremy Bowman
1a5bf35357 TE-2689 Remove useless pylint suppressions part 2 2018-08-14 17:39:02 -04:00
Jeremy Bowman
4e8668d3be TE-2524 Stop using nose.plugins - LMS 2 2018-08-01 13:54:06 -04:00
Waheed Ahmed
780c1d982d Rate limit course list API.
This endpoint is likely being inefficient with how it's querying various parts
of the code and can take courseware down, it needs to be rate limited until
optimized.

LEARNER-5527
2018-06-13 16:59:32 +05:00
Albert (AJ) St. Aubin
e3c84bc8de Revert "Rate limit course list API." 2018-06-12 12:06:51 -04:00
Waheed Ahmed
803a6c742c Rate limit course list API.
This endpoint is likely being inefficient with how it's querying various parts of the code
and can take courseware down, it needs to be rate limited until optimized.

LEARNER-5527
2018-06-12 14:58:12 +05:00
Eric Fischer
247bb50ed2 s/django.core.urlresolvers/django.urls/g
Django 1.10 deprecation fix for Hackathon XIX
Addresses PLAT-1397
2018-06-05 13:59:09 -04:00
Stuart Young
1fd2167144 rebalance python unittests onto new shards 2018-05-03 11:16:05 -04:00
Omar Al-Ithawi
fc7f98362d Add search for courses API 2018-02-17 17:23:05 +02:00
Jose Antonio Gonzalez
f38e5ab939 add DEFAULT_MOBILE_AVAILABLE flag 2017-11-16 16:50:37 +02:00
Simon Chen
29a1df3323 Revert "Exposing course run license via Course API"
This reverts commit a1419b15f7.
2017-10-11 12:37:09 -04:00
Clinton Blackburn
a1419b15f7 Exposing course run license via Course API
The license for course run content is now stored on the CourseOverviews model and exposed via the Course API.

LEARNER-2791
2017-10-08 19:47:32 -04:00
Jose Antonio Gonzalez
aca096138b add invitation_only field to course serializer 2017-06-29 16:08:58 +02:00
Andy Armstrong
79acb5c5be Reorder LMS imports using isort 2017-06-11 21:48:06 -04:00
John Eskew
3b57542ab0 Revert "Merge pull request #15170 from edx/jeskew/PLAT_1316_partitions_inheritance"
This reverts commit f97f052591, reversing
changes made to 800bcd8e20.
2017-05-30 12:42:54 -04:00
John Eskew
66f3aa5ccf Move fields.py, inheritance.py, and partitions to openedx/core. 2017-05-25 13:24:08 -04: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
Matthew Piatetsky
af976a0ef5 Add JWT auth and hidden flag to course_api 2016-11-03 17:35:45 -04:00
Matthew Piatetsky
dc5f251938 Revert "Merge pull request #13846 from edx/ECOM-5050"
This reverts commit c6b6d0bc74, reversing
changes made to fa2b1ae470.
2016-10-31 10:04:20 -04:00
Matthew Piatetsky
ef0699c4d8 Add hidden flag and return courses hidden in LMS when include_hidden is passed 2016-10-27 13:43:35 -04:00
Matthew Piatetsky
3d72229168 Expose mobile-friendly field for course runs returned by Course API 2016-10-20 14:35:31 -04:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Calen Pennington
853bfe7a36 Add a TestCase mixin for enabling caches in tests
By default, disable all caching in tests, to preserve test independence.
In order to enable caching, inherit from CacheSetupMixin, and specify
which cache configuration is needed.

[EV-32]
2016-05-04 14:51:30 -04:00
Ben Patterson
1db84e79df Additional shard balancing changes for unit tests. 2016-04-28 10:09:32 -04:00
Ben Patterson
b9558a90f1 Create a 3rd explicit shard for unit tests.
More accurately, this creates a 4th shard because the
last shard is always the default.
2016-04-28 10:09:32 -04:00
Clinton Blackburn
00b48e54a1 Exposing absolute/CDN image URLs via Course API
ECOM-4013
2016-04-01 09:42:57 -04:00
Clinton Blackburn
1185fff1ec Added pacing field Course API
ECOM-3994
2016-03-30 14:36:43 -04:00
Sanford Student
6490551f1b MA-2103 2016-03-08 16:17:01 -05:00
Nimisha Asthagiri
a00c2a7c47 Course API: Change field name from course_id to id 2015-12-28 16:24:54 -05:00
Nimisha Asthagiri
3d84e29218 Update Course Catalog API to include About Overview field. 2015-12-28 15:03:22 -05:00
Nimisha Asthagiri
8e3f4e058d Update Course Catalog API to support filters 2015-12-23 12:31:31 -05:00
Renzo Lucioni
2cee39d535 Modify Course API to filter visible courses by org
Org to filter by is provided to the Course API list view using a querystring argument. Filtering ultimately occurs at the database layer. ECOM-2761.
2015-12-14 15:32:46 -05:00
Nimisha Asthagiri
bb53c03e24 Optimize Course Catalog/About API with Course Overviews 2015-12-10 17:15:42 -05:00
Nimisha Asthagiri
91153aea83 Update Course About API to include effort and video
MA-1661
2015-12-04 16:03:06 -05:00
J. Cliff Dyer
f53de2c04a Paginate results of Courses API list endpoint
* Catalog results are now paginated
* Implements the new namespaced pagination described at
  https://openedx.atlassian.net/wiki/pages/viewpage.action?pageId=47481813
* API level code returns pythonic business objects
* View layer performs serialize at the view layer
* Convert views to use DRF generic views
* Removes an unintentional authentication decorator that caused
  the detail endpoint to return a 401 for anonymous users

MA-1724
2015-12-01 08:13:18 -05:00
Michael Frey
29b6ccf5e4 Added new Course List API. 2015-11-24 15:54:03 +00:00