Commit Graph

344 Commits

Author SHA1 Message Date
Simon Chen
1d186b34bf MST-734 Fix production issue on Learner Onboarding Status Panel (#27248)
* MST-734 Fix production issue on Learner Onboarding Status Panel
Fix the prod issue where learning sequence service object missing the needed get_user_course_outline service API
The user web API call currently returns 500
2021-04-05 16:54:58 -04:00
Nizar Mahmoud
5f7dbc2d45 docs: updates ticket annotations for block structure settings and toggles
Updates the annotations for the block structure settings and toggles based on a [discussion] that was held on the pull request that annotated those same settings and toggles.

It also adds the DEPR tickets that were promised earlier in the annotations.
For future reference, there's also a [forum thread] to discuss the DEPR tickets titled.

[discussion]: https://github.com/edx/edx-platform/pull/26175#issuecomment-800632485

[forum thread]: https://discuss.openedx.org/t/deprecation-removal-several-block-structure-caching-settings-depr-143-depr-144-depr-145-depr-146/4288?u=nizar
2021-03-18 13:05:32 +03:00
M. Zulqarnain
6266caf143 refactor: pyupgrade in openedx/content app (#26891) 2021-03-17 17:28:06 +05:00
M. Zulqarnain
0d86ebb361 refactor: pyupgrade in openedx/content app (#26890) 2021-03-17 17:27:48 +05:00
Jawayria
b578dba357 Merge pull request #26599 from edx/jawayria/bom-2408-2
BOM-2408: Removed unused imports from openedx/core/djangoapps/content
2021-03-17 16:54:20 +05:00
David Ormsbee
82ca05392e fix: Fix proctored exam display in learning_sequences admin.
I had the wrong attribute before this commit, and Django Admin let
me get away with it because it doesn't explode when you try to grab
relations that aren't there–it just quietly returns None in some of
those cases.
2021-03-16 09:50:28 -04:00
Matt Tuchfarber
30d59f2fcc Merge pull request #26991 from edx/tuchfarber/fix_transaction_bug
feat: Pass date in cert date update signal
2021-03-16 08:01:27 -04:00
Jawayria
ac74263098 BOM-2408: Removed unused imports from openedx/core/djangoapps/content 2021-03-16 16:39:04 +05:00
David Ormsbee
3a552c4fdf feat: Outline error handling and admin improvements.
* Introduces the idea of content errors into the learning_sequences
  public API, accessible using get_content_errors().
* Makes course outline generation much more resilient to unusual
  structures (e.g. Section -> Unit with no Sequence in between),
  with the understanding that anything that doesn't conform to the
  standard structure will simply be skipped.
* Improves the Django Admin for learning_sequences to display
  content errors and improve sequence data browsing within a course.
* Switches the main table viewed in the Django admin from
  LearningContext to CourseContext, which is appropriate since only
  course runs generate outlines.

This was done as part of TNL-8057, with the end goal of making
course outline generation resilient enough to switch over apps
to using the learning_sequences outline API. The types of course
structure errors that this PR addresses cause display issues even
in the current Outline Page experience, but would break the outline
generation for learning_sequences altogether.

The approach for error messages here is very generic, to keep
modulestore concepts from seeping into learning_sequences (which is
not aware of the modulestore/contentstore). We may need to address
this later, with a more normalized content error data model.

While the Django admin page is backwards compatible with the old
versions of the models, we should run the backfill_course_outlines
management command after deploying this change, to get the full
benefits.
2021-03-15 01:31:36 -04:00
Matt Tuchfarber
7dd4a2b6fd fix: Pass date in cert date update signal
Because the available date update to the CourseOverview happens inside a
view's signal and we have atomic requests on, the read that was
happening inside the task happened *before* the write was commited to
the database. To avoid the unknown bugs that would come from disabling
atomic transactions for that view (since it's large), this passes the
date we want down through the signals and tasks so we can skip the DB
read at the end.
2021-03-12 13:57:50 -05:00
Matt Tuchfarber
09bb25bbcd exp: Add logging to course cert availability date
I believe there to be a race condition here that only manifests in a
non-devstack environment. Adding some logging to better diagnose.
2021-03-10 17:01:45 -05:00
David Ormsbee
8aa056e230 perf: Instrument all learning_sequences API calls.
This will make it possible to make a New Relic dashboard for the
learning_sequences API calls that tracks call performance across
different transactions (by querying Spans). Our goal would be to
offer SLAs around 99th percentile performance.

Course IDs and User ID metrics are also added, so that we can see
outliers in Span reporting, for later investigation.
2021-03-10 10:19:30 -05:00
David Ormsbee
f5b74fcf31 feat: Backfill and Django Admin for Learning Sequence Outline
* Adds the backfill_course_outlines management command to contentstore
* Adds a read-only Django admin interface to learning_sequences for the
  support team and debugging.
* Adds two new functions to the learning_sequences public API:
  key_supports_outlines and get_course_keys_with_outlines

The learning_sequences app isn't supposed to know about contentstore or
modulestore, as it's intended to be extracted out of edx-platform in the
long term. Therefore, the backfill_course_outlines command is in
contentstore, and not learning_sequences.

This work was tracked in TNL-7983, but it also fixes a bug where we were
trying to generate course outlines for libraries (TNL-7981).

All Open edX instances upgrading to Lilac should run the
backfill_course_outlines command as part of their upgrade process.
2021-03-09 09:05:57 -05:00
David Ormsbee
6a00878f59 fix: learning_sequences missing courses now return 404 (not 500)
We weren't properly catching the CourseOutlineData.DoesNotExist error
before this commit. TNL-7979
2021-03-09 09:05:57 -05:00
Matt Tuchfarber
6c97dfe1e5 Move cert date signals to avoid race conditions
COURSE_CERT_DATE_CHANGE was being called before saving the new data in
the course overview. The listeners were expecting to pull the data out
of the course overview, and thus were only right about half the time.
This moves the signal to trigger after the course publish signals are
handled.
2021-03-04 15:57:21 -05:00
Usman Khalid
dd96a2aa72 Convert Course, Section and Sequence XModules to XBlocks. (#25965) 2021-03-02 10:29:33 -05:00
Zachary Hancock
1af3b5a68c runtime service exposing learning_sequences api to proctoring (#26692) 2021-02-24 17:25:49 -05:00
Michael Terry
74887aa216 feat: turn on schedule creation by default
This commit removes several waffle toggles that have been enabled
on edx.org for years. It's time to remove the rollout gating for
these features and enable them by default.

This doesn't directly change any behavior. But it does create new
database objects by default now and allows for enabling other
schedule based features more easily.

Specifically, the following toggles were affected.

schedules.create_schedules_for_course
- Waffle flag removed as always-enabled
- We now always create a schedule when an enrollment is created

schedules.send_updates_for_course
- Waffle flag removed as always-enabled
- Course update emails are sent as long as the ScheduleConfig
  allows it.
- This is not a change in default behavior, because ScheduleConfig
  is off by default.

dynamic_pacing.studio_course_update
- Waffle switch removed as always-enabled
- Course teams can now always edit course updates directly in Studio

ScheduleConfig.create_schedules
ScheduleConfig.hold_back_ratio
- Model fields for rolling out the schedules feature
- Schedules are now always created
- This commit only removes references to these fields, they still
  exist in the database. A future commit will remove them entirely

This commit also adds a new has_highlights field to CourseOverview.
This is used to cache whether a course has highlights, used to
decide which course update email behavior they get. Previously every
enrollment had to dig into the modulestore to determine that.
2021-02-23 12:34:02 -05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
Aarif
d2644e2dc2 replaced unittest assertions pytest assertions (#26554) 2021-02-18 18:06:13 +05:00
Muhammad Soban Javed
108859a550 Merge pull request #25954 from edx/iamsobanjaved/celery-tasks-openedx
Replace @task decorator with @shared_task in openedx
2021-02-08 18:23:22 +05:00
M. Zulqarnain
047a5f5f19 BOM-2319 : Pylint amnesty in openedx content apps (#26347)
* pylint amnesty in openedx content apps

Co-authored-by: Jawayria <jawayriahashmi@gmail.com>
2021-02-08 15:51:22 +05:00
Carla Duarte
a08faaaa9c Merge pull request #26360 from edx/ciduarte/AA-635
AA-635: learner dashboard course card image bug
2021-02-04 14:58:53 -05:00
Robert Raposa
87a3777a79 Merge pull request #26374 from regisb/regisb/no-future
[BD-21] Upgrade usage of edx_toggles.toggles
2021-02-04 08:43:06 -05:00
Soban Javed
5199bf7acb Replace task decorator with shared_task in openedx 2021-02-04 18:35:38 +05:00
Régis Behmo
9370eae0a2 Upgrade usage of edx_toggles.toggles
The waffle classes previously in future are now available directly from
edx_toggles.toggles. Since this future module is going to be removed soon,
we become future-proof by getting rid of it.
2021-02-04 10:51:58 +01:00
Carla Duarte
d6beb37d72 AA-635: learner dashboard course card image bug 2021-02-03 16:21:43 -05:00
David Ormsbee
185e6c2d76 fix: RST formatting for APIs ADR. (#26336) 2021-02-03 08:13:25 -05:00
Robert Raposa
eba1e282da Merge pull request #26175 from open-craft/nizar/tsd-block-structure-storage-caching
[TSD] Annotates block structures settings and waffle switches
2021-02-01 16:53:04 -05:00
Nizar Mahmoud
fa9746a714 Annotates block structures settings and waffle switches
This includes the following settings:

- BLOCK_STRUCTURES_SETTINGS : setting dictionary which stores the other different block structures related settings

- BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] : keeps only a specific number of versions of each block structure, and deletes the rest

- BLOCK_STRUCTURES_SETTINGS['COURSE_PUBLISH_TASK_DELAY'] : specifies the delay, in seconds, after a new edit of a course is published before updating the block structures cache

- BLOCK_STRUCTURES_SETTINGS['TASK_DEFAULT_RETRY_DELAY'] : Specifies the delay, in seconds, between retry attempts for block structure tasks

- BLOCK_STRUCTURES_SETTINGS['TASK_MAX_RETRIES'] : specifies the max number of retries per block structure task

- BLOCK_STRUCTURES_SETTINGS['STORAGE_CLASS'] : specifies the storage which block structures would be saved to when storage backed block structures are enabled

    Example: 'storages.backends.s3boto.S3BotoStorage'

- BLOCK_STRUCTURES_SETTINGS['STORAGE_KWARGS'] : specifies additional arguments needed when utilizing storage for storing storage backed block structures

    Example: { bucket: 'test-edxapp' }

- BLOCK_STRUCTURES_SETTINGS['DIRECTORY_PREFIX'] : specifies the path to which storage backed block structures are saved

    Example: '/courses/'

This also includes the following waffle switches:

- block_structure.storage_backing_for_cache : enables storage backed block structures, used to retrieve the block structures from storage instead of regenerating the structure, when not available in cache

    it is important to note that this is important for production because it reduces response times on block structure related apis

- block_structure.raise_error_when_not_found : raises an error if the block structure requested doesnt exist in store or is outdated

- block_structure.invalidate_cache_on_publish : invalidates the block structure cache when courses are published

For an example with additional context, see the following forum post:

https://discuss.openedx.org/t/help-please-very-slow-load-time-10-seconds-for-courseware-on-sections-with-several-subsections-and-xblocks/2998/16

This also includes information about the toggles that will likely be deprecated and removed:

https://github.com/edx/edx-platform/pull/26175#issuecomment-769080286
2021-02-01 22:55:14 +03:00
David Ormsbee
d531d38ec7 Fix formatting on interapp APIs extension ADR.
The numbered lists were not written correctly.
2021-01-28 09:56:38 -05:00
David Ormsbee
669677c78a Push Course Outlines to learning_sequences on publish.
The learning_sequences app has its own model for Course Outlines.
Prior to this commit, these course outlines were only populated by
a management command in the learning_sequences app that queried
modulestore. This commit does a few things:

1. Move the update_course_outline command to live in contentstore
   (i.e. Studio). This makes learning_sequences unaware of
   modulestore, and makes it easier for us to extract it from
   edx-platform (or to plug in different kinds of course outlines).
2. Add tests.
3. Add performance and debug logging to course outline creation.
4. Make course outline creation happen every time a course publish
   happens.

This will allow us to start collecting data about how long building
course outlines takes, and get error reporting around any content
edge cases that break the course outline code.
2021-01-28 09:56:28 -05:00
Régis Behmo
3a29cff016 Get rid of calls to set_request_cache_with_short_name
This method from the toggle legacy classes should not actually be
exposed to all. So we get rid of it by manually setting the cached
value. While we are at it, we convert the STORAGE_BACKING_FOR_CACHE
legacy waffle switch to its modern version. As the flag is not being
used elsewhere, this should not break anything.

We take the opportunity to modernize waffle switches from
block_structure.config: to do so we convert the INVALIDATE_CACHE_ON_PUBLISH and
RAISE_ERROR_WHEN_NOT_FOUND waffle switches from legacy classes to their modern
equivalents. These switches are not used outside of edx-platform, so this
change should not trigger any error.
2021-01-12 16:52:08 +01:00
Usman Khalid
9e38b17202 Convert ErrorModule and NonStaffErrorModule to XBlocks. (#25570) 2021-01-07 10:51:33 -05:00
Régis Behmo
a16cd71046 Start waffle namespace deprecation
By explicitly importing the legacy namespace classes, we make it clear
that we are using soon-to-be-deprecated classes. We will then be able to
start removing the legacy classes, one module at a time.
2020-12-03 16:06:14 +01:00
Nimisha Asthagiri
3426491dde Merge pull request #25543 from open-craft/nizar/catch_blockstructure_not_found_on_cache_invalidation
[SE-3439] Fixes block structure not caching when cache invalidation is enabled
2020-12-02 09:36:42 -05:00
Robert Raposa
b8168fc46d add code_owner for block_structure_task
While adding code_owner for celery tasks in
earlier PRs, we missed `@block_structure_task()`.

ARCHBOM-1260
2020-11-23 12:18:37 -05:00
0x29a
8961db4f10 Fix imports, remove unused import 2020-11-19 14:37:09 +01:00
Robert Raposa
8eef18710d set code_owner for celery tasks
ARCHBOM-1260

Co-authored-by: Tim McCormack <tmccormack@edx.org>
2020-11-17 15:33:33 -05:00
David Ormsbee
6a55b833dc Merge pull request #25045 from open-craft/gabor/expose-banner-image-url
[SE-3329] Expose banner image url in course API
2020-11-17 11:08:18 -05:00
Patrick Cockwell
586d6721e1 [BD-29] [TNL-7264] Add Milestones, Content Gating, and Special Exams Outline Processors (#24545)
Extend the learning_sequences Course Outline API to handle milestones,
content gating, and special exams. This includes things like entrance exams
that would block other content from being accessible, and proctored exams
which would be unavailable until an exam is started.

Co-authored-by: Agrendalath <piotr@surowiec.it>
2020-11-16 09:29:40 -05:00
Gábor Boros
2a35410fe4 Expose banner image URL in course API
Banner image URL is exposed on the course list and course details API
endpoints. The new `banner_image_url` API field has both the relative
and absolute URLs for the image it represents, if it is set.
2020-11-13 15:35:13 +01:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Nizar Mahmoud
e4c8897014 Catches BlockStructureNotFound raised when clearing course from cache 2020-11-07 14:17:25 +03:00
Régis Behmo
4586002956 Import waffle classes from edx_toggles instead of waffle_utils
Those classes were ported to edx_toggles. The imports remain in
waffle_utils.__init__ for backward compatibility.
2020-11-03 19:25:37 +01:00
Régis Behmo
3b127f8c92 Deprecate WaffleSwitch.override* methods
This allows us to get rid of the custom WaffleSwitch and
WaffleSwitchNamespace classes from waffle_utils in favour of
edx_toggles.toggles classes.
2020-11-03 19:25:37 +01:00
Régis Behmo
2307dff4c9 Deprecate WaffleFlag.override method
This allows us to get rid of waffle_utils' custom WaffleFlag method.
2020-11-03 19:25:37 +01:00
David Ormsbee
ab622d2bf8 Reduce noise in CourseOverview->Modulestore fallback (#25434)
This was originally intended as a placeholder to remind us to
optimize the data model for sequence metadata API calls (say
by adding those fields to the CourseOverview model itself).
Logging a quarter million messages a day is overkill for this
purpose, and we will be doing another pass at the performance of
this code in the coming weeks/months.
2020-10-26 10:27:14 -04:00
Bill Currie
17e69d7881 Adds support for beta users to the course outline API
Adds days_early_for_beta to the ScheduleData class, and its loading
and usage to ScheduleOutlineProcessor.
2020-09-02 16:48:51 +05:30
Demid
bf306ec482 Support self-paced courses in learning_sequences app
The main difference between how instructor-paced and self-paced courses
work with respect to the outline on the backend is how we treat the
hide_after_due attribute on subsections (sequences). Namely, self-paced
courses ignore due dates even if they are specified on the sequence
(for example, by OLX import). If hide_after_due is True in a self-paced
course sequence, we only make it inaccessible after the entire course
ends.

This was tracked as BD-29 and TNL-7262.
2020-08-27 12:54:20 -04:00