Commit f95c79c
fix: Prevent infinite loop in legacy edx course export op
The export_edx_courses op in the legacy IRx pipeline had two bugs that
caused the courses/ folder to silently go missing in the S3 data packages
(observed since ~2026-01-21 for mitx-etl-mitxonline-production):
1. Infinite loop in the status-polling while loop
When check_course_export_status() raised httpx.HTTPStatusError (e.g.,
HTTP 404 from django-user-tasks after record cleanup, or a deleted
course), the bare 'continue' swallowed the error without adding the
course to failed_exports. The while-loop condition
len(successful U failed) < len(tasks) was never satisfied, so the
job hung indefinitely and the courses/ folder was never written.
Fix: catch HTTPStatusError, log the status code and course id, and
add the course to failed_exports so the loop can terminate. Also add
a 60-minute hard timeout (matching the openedx asset-based code) and
skip courses already resolved to avoid redundant API calls.
2. Abort on partial-failure from the export trigger API
The ol_openedx_course_export plugin returns HTTP 400 when any course
fails to queue, even if other courses succeeded. The unconditional
raise_for_status() call caused export_courses() to raise immediately,
aborting the entire op before any successfully-queued tarballs could
be copied.
Fix: allow HTTP 400 through so the caller receives the response body
(upload_task_ids + failed_uploads) and can still process the courses
that were queued successfully. Log the initially-failed courses as a
warning.
Fixes: mitodl/hq#11104
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent efcd756 commit f95c79c
2 files changed
Lines changed: 40 additions & 3 deletions
File tree
- dg_projects/legacy_openedx/legacy_openedx/ops
- packages/ol-orchestrate-lib/src/ol_orchestrate/resources
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
577 | 579 | | |
578 | 580 | | |
579 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
580 | 588 | | |
581 | 589 | | |
582 | 590 | | |
583 | 591 | | |
584 | 592 | | |
585 | 593 | | |
| 594 | + | |
586 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
587 | 604 | | |
588 | 605 | | |
| 606 | + | |
| 607 | + | |
589 | 608 | | |
590 | 609 | | |
591 | 610 | | |
592 | 611 | | |
593 | 612 | | |
594 | | - | |
595 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
596 | 623 | | |
597 | 624 | | |
598 | 625 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
| |||
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
75 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
0 commit comments