From 3e4ff4019bd864ec4bd305db34c76f83f63d2588 Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Fri, 10 Apr 2026 18:13:49 +0200 Subject: [PATCH] limit number of workers --- bincio/extract/cli.py | 2 +- bincio/extract/config.py | 2 ++ docs/deployment/vps.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bincio/extract/cli.py b/bincio/extract/cli.py index b95ec37..6ddf179 100644 --- a/bincio/extract/cli.py +++ b/bincio/extract/cli.py @@ -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} diff --git a/bincio/extract/config.py b/bincio/extract/config.py index 1c8c6a1..baa72d6 100644 --- a/bincio/extract/config.py +++ b/bincio/extract/config.py @@ -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, diff --git a/docs/deployment/vps.md b/docs/deployment/vps.md index 4c1e905..1a5f9b5 100644 --- a/docs/deployment/vps.md +++ b/docs/deployment/vps.md @@ -206,6 +206,8 @@ sources: output: dir: /var/bincio/data + +workers: 2 # cap extract parallelism on the VPS (default: all CPUs) ``` Sync and extract (run from your laptop or SSH in):