limit number of workers

This commit is contained in:
Davide Scaini
2026-04-10 18:13:49 +02:00
parent cf414a08ad
commit 3e4ff4019b
3 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ def extract(
dedup = DedupIndex(output_dir=cfg.output_dir)
known_hashes: frozenset = frozenset(dedup._by_hash.keys())
n_workers = workers or os.cpu_count() or 4
n_workers = workers or cfg.workers or os.cpu_count() or 4
console.print(f"Using [bold]{n_workers}[/bold] worker processes.")
owner = {"handle": cfg.owner_handle, "display_name": cfg.owner_display_name}
+2
View File
@@ -51,6 +51,7 @@ class ExtractConfig:
track: TrackConfig = field(default_factory=TrackConfig)
classifier: ClassifierConfig = field(default_factory=ClassifierConfig)
incremental: bool = True
workers: Optional[int] = None # None → use CPU count
owner_handle: str = "me"
owner_display_name: str = "Me"
athlete: AthleteConfig | None = None
@@ -109,6 +110,7 @@ def load_config(path: Path) -> ExtractConfig:
track=track,
classifier=classifier,
incremental=raw.get("incremental", True),
workers=raw.get("workers"),
owner_handle=owner.get("handle", "me"),
owner_display_name=owner.get("display_name", "Me"),
athlete=athlete,