Skip to content

ingestion of test/sandbox courses #2224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions frontends/api/src/generated/v0/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions frontends/api/src/generated/v1/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions learning_resources/etl/edx_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from tarfile import ReadError
from tempfile import TemporaryDirectory

from django.db.models import Q

from learning_resources.etl.constants import ETLSource
from learning_resources.etl.loaders import load_content_files
from learning_resources.etl.utils import (
Expand Down Expand Up @@ -109,12 +111,18 @@ def sync_edx_course_files(
matches = re.search(rf"{s3_prefix}/(.+)\.tar\.gz$", key)
run_id = matches.group(1).split("/")[-1]
log.info("Run is is %s", run_id)
runs = LearningResourceRun.objects.filter(
learning_resource__etl_source=etl_source,
learning_resource_id__in=ids,
learning_resource__published=True,
published=True,
runs = (
LearningResourceRun.objects.filter(
learning_resource__etl_source=etl_source,
learning_resource_id__in=ids,
)
.filter(Q(published=True) | Q(learning_resource__test_mode=True))
.filter(
Q(learning_resource__published=True)
| Q(learning_resource__test_mode=True)
)
)

if etl_source == ETLSource.mit_edx.name:
# Additional processing of run ids and tarfile names,
# because edx data is structured differently
Expand Down Expand Up @@ -142,7 +150,11 @@ def sync_edx_course_files(
resource = run.learning_resource
if run != (
resource.next_run
or resource.runs.filter(published=True).order_by("-start_date").first()
or resource.runs.filter(
Q(published=True) | Q(learning_resource__test_mode=True)
)
.order_by("-start_date")
.first()
):
log.info("Skipping %s, not the next / most recent run", run.run_id)
continue
Expand Down
Loading
Loading