Repository navigation
Conversation
Since #4384 only the data platform's OVS webhook loads OVS videos, so a local stack had no way to get any. --load fetches the OVS public API (include_in_learn=true, following pages), keeps the removed extract's public/Complete filter, and runs each video through the webhook's loader under the webhook pipeline. It refuses unless (ovs, video_playlist) and (ovs, video) are owned by the webhook, so it can't write where the push wouldn't.
There was a problem hiding this comment.
Summary
Adds local seeding of OVS videos through the public API.
- Adds:
--loadmode to seed OVS videos from the public API. - Changes: loading to follow API pages, skip non-public or incomplete videos, and use
load_ovs_video_from_webhook. - Changes: loading to require webhook ownership of OVS playlists and videos before writing.
Details for reviewers
Core files: learning_resources/management/commands/backpopulate_ovs_data.py
More changes
- Adds: tests for pagination, filtering, ownership checks, and loaded video results. (
backpopulate_ovs_data_test.py)
Unchanged
- Existing transcript fetching and OVS video deletion modes remain available.
Summary of 6aa0ff7 · React 👍 or 👎 on my comments to tune what I raise · Commands · Review config
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
--load now runs each video through OVSVideoWebhookRequestSerializer, the check the webhook makes before loading, and skips the ones it rejects instead of writing them or stopping the run. It clears the views cache afterward as the webhook does, and its refusal message says to add the ownership rows, which a fresh database doesn't have.
OVS_TYPES now lives in learning_resources/etl/ovs.py, and the webhook view, sweep_empty_ovs_playlists and --load all import it, so they can't check different ownership rows. The --load test now asserts the second request goes to the page's next url, and its ownership helper drops a parameter every call passed the same value.
What are the relevant tickets?
N/A. Follow-up to #4384.
Description (What does it do?)
Since #4384, only the data platform's OVS webhook loads OVS videos, so a local stack has no way to get any. This adds
--loadtobackpopulate_ovs_datato seed them from the OVS public API.${OVS_API_BASE_URL}/api/v0/public/videos/?include_in_learn=trueand skips videos that aren'tComplete(the API returns only public ones)OVSVideoWebhookRequestSerializer, then loads it with the webhook's loader,load_ovs_video_from_webhook, so the legacy ETL doesn't come back. A video the serializer rejects is skipped, with its errors on stderr.(ovs, video_playlist)and(ovs, video)are owned by the webhook, the same check the webhook makes before it writesOVS_TYPESonce inlearning_resources/etl/ovs.py, so the webhook view,sweep_empty_ovs_playlistsand--loadcheck the same ownership rowsIt's meant for local seeding. In deployed environments the webhook still loads OVS, and a refused push is resent from Dagster (runbook).
How can this be tested?
On local-dev (ol-infrastructure's Tilt stack), with this branch checked out in the mit-learn clone Tilt builds:
local-dev/apps/mit-learn/configmaps/app-env.local.yamlin ol-infrastructure (copy it fromapp-env.local.yaml.exampleif you don't have one). The pods roll on their own.The webhook does not own ovs/video_playlist, video…:ETLSourceOwnershiprows forovs/video_playlistandovs/videowith ownerwebhook.Loaded N OVS videos, skipped M, and the videos should show up in search once the celery worker has indexed them. Running it again shouldn't create duplicates.I ran this on local-dev against RC (passing the two settings on the command line instead of the ConfigMap): the first run refused, then
--loadloaded 130 videos into 2 playlists, all 130 were indexed in OpenSearch, and a second run left the counts unchanged.pytest learning_resources/management/commands/backpopulate_ovs_data_test.pypasses.