feat(api): port repair_audio_analyses backfill job#900
Merged
Conversation
Adds a recurring job that backfills missing track bpm / musical_key from content-node audio analyses, a direct port of apps' discovery-provider repair_audio_analyses celery task (3-minute beat). Each pass selects up to 1000 current tracks missing a non-custom bpm or musical_key (error count < 3, streamable, non-podcast, newest first), picks up to 5 random registered content nodes, and for each track queries the modern uploads endpoint (when audio_upload_id is set) or the legacy blob-analysis endpoint, falling back to the next node on error. It fills in any missing+valid bpm / musical_key and syncs the stored error count, committing per track. Validation mirrors apps: valid_bpm is a float in (0, 999); valid musical keys come from the flats-only MusicalKey enum. Both lowercase (mediorum) and capitalized (legacy python content node) JSON keys are accepted. Wired into startParityJobs with the SDK passed through for content-node discovery via Eth.GetRegisteredEndpoints. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Advances github.com/OpenAudio/go-openaudio and .../pkg/etl from 5ed068b to dca79f0 (go-openaudio#334), so the vendored ETL indexer persists track bpm/musical_key/audio_upload_id. This is the prerequisite for the repair_audio_analyses job in this PR: without it the indexer keeps leaving these fields NULL, and the backfill has nothing to reconcile against (no audio_upload_id to key the modern uploads endpoint on). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Member
Author
|
Bumped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a recurring job that backfills missing track
bpm/musical_keyfrom content-node audio analyses — a direct port of apps' discovery-providerrepair_audio_analysescelery task (3-minute beat). This is the parity-correct backfill mechanism for tracks left without bpm/key (companion to the indexer fix in go-openaudio#334).Each pass:
audio_analysis_error_count < 3, a streamabletrack_cid, non-podcast/audiobook genre, newest first.content-nodeendpoints viaEth.GetRegisteredEndpoints./uploads/{audio_upload_id}(modern) or/tracks/legacy/{track_cid}/analysis(legacy, whenaudio_upload_idis empty), falling back to the next node on transport/non-2xx error.Validation mirrors apps:
valid_bpmis a float in(0, 999); valid musical keys come from the flats-onlyMusicalKeyenum. Both lowercase (mediorum) and capitalized (legacy python content node) JSON keys are accepted.Changes
jobs/repair_audio_analyses.go: the job (query → node discovery → per-track fetch/apply).jobs/musical_key.go:isValidMusicalKey+ the enum map.jobs/repair_audio_analyses_test.go: unit tests.indexer/indexer.go: register instartParityJobs(every 3 min), passing the SDK for content-node discovery.Test plan
go build ./jobs/... ./indexer/...+go vet ./jobs/clean🤖 Generated with Claude Code