Analyse tracks in a pool of worker processes
A first pass over an unanalysed library is hours of librosa, and there was no reason for a desktop to spend them one core at a time. Analysis now runs in a process pool sized by `general.library.analysis_workers`, defaulting to one per core bar one (capped at 8) when the key is absent. Two consequences worth knowing before touching this: whatever an `Analyzer` returns has to be picklable, and an analyzer that keeps state on its own instance - a test double counting calls - only behaves as written with `analysis_workers=1`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -172,6 +172,11 @@ class LibraryConfig(_Strict):
|
||||
root: Path
|
||||
#: Scan results, extracted cover art and track analysis. Relative to this file.
|
||||
cache: Path = Path(".musicmouse-cache")
|
||||
#: How many tracks background analysis may work on at once, each in its own worker
|
||||
#: process. Omit for one per core bar one (see
|
||||
#: :func:`musicmouse.library.workers.default_worker_count`); set it to 1 to keep
|
||||
#: analysis to a single process on a machine that has other work to do.
|
||||
analysis_workers: int | None = Field(default=None, ge=1)
|
||||
|
||||
@field_validator("root")
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user