Skip to content

Parallelize ACR fingerprinting + progressive viewer + reanalyze buttons - #3

Merged
robrien20 merged 1 commit into
mainfrom
claude/nice-yalow-7664a8
May 5, 2026
Merged

robrien20 merged 1 commit into
mainfrom
claude/nice-yalow-7664a8

Conversation

@robrien20

Copy link
Copy Markdown
Owner

Summary

  • Fingerprint speed-up (~10–20x): swap ThreadPoolExecutor → ProcessPoolExecutor (20 workers) so ACR recognition truly parallelizes. Threads were serialising on the GIL held by acrcloud's native C extension — process pool bypasses it. Each worker constructs its own ACRCloudRecognizer from a config dict.
  • Progressive results in the UI: fingerprint windows now stream into tracks.json as they complete (with a "partial": true marker), and the viewer's 2 s polling loop reloads the fingerprint step while it's running instead of waiting for done. Tracklist populates live.
  • Redirect on ingest: the library page navigates to /set.html?id=… the moment set_id is known (right after the file is downloaded), rather than waiting for all analysis to finish. The set page handles missing analysis JSONs gracefully and fills them in via polling.
  • Reanalyze buttons: ↺ reanalyze on the BPM, Key, Waveform, and Tracklist panels. Backed by a new POST /api/sets/{set_id}/analyze endpoint and orchestrator.reanalyze_steps(), which only touches the requested steps' status (no skipped overwrites).
  • Quieter logs: uvicorn log level dropped from info to warning so per-request audio range chatter doesn't bury real output.

Test plan

  • Import a YouTube DJ set; verify the browser auto-navigates to the set page once the download completes
  • While analysis runs, watch BPM / key / tracks panels populate progressively
  • Confirm fingerprint windows complete out-of-order (true parallelism — [42/168] before [3/168]) and the run finishes much faster than before
  • Click ↺ reanalyze on each panel; verify just that step re-runs and the data updates without touching the others
  • Direct-load /set.html?id=… for a set whose analysis is mid-flight; confirm polling kicks in and fills data as it lands

…sive results, reanalyze buttons, redirect on ingest

Speed up fingerprinting by ~10-20x by switching from sequential ACR calls to
20 worker processes — threads serialise on the GIL held by the acrcloud
native C extension, so ProcessPoolExecutor is the only path to true
parallelism. Each worker creates its own ACRCloudRecognizer from a config
dict.

Progressive UX:
- Fingerprint windows now stream results into tracks.json as they complete
  (writes a "partial": true marker), and viewer polling reloads the
  fingerprint step while it's still "running" rather than waiting for done.
- Library page redirects to the set page as soon as ingest finishes (set_id
  is known) so users see analysis populate live instead of staring at a log.

Reanalyze controls:
- New POST /api/sets/{set_id}/analyze endpoint accepts {steps: [...]} and
  reruns just those steps via orchestrator.reanalyze_steps() — leaves other
  step statuses untouched.
- ↺ reanalyze buttons on BPM, Key, Waveform, and Tracklist panels; click
  POSTs the request, subscribes to the SSE job stream, and reloads the
  step's data the moment it's done.

Misc: drop uvicorn log level to "warning" to silence per-request audio
range chatter.
@robrien20
robrien20 force-pushed the claude/nice-yalow-7664a8 branch from 48bbcdf to 8954622 Compare May 5, 2026 16:20
@robrien20
robrien20 merged commit 92a254d into main May 5, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant