Slice 1: Config field + CLI flag #12

Closed
opened 2026-06-03 16:46:22 +02:00 by AlexKucera · 1 comment
AlexKucera commented 2026-06-03 16:46:22 +02:00 (Migrated from github.com)

Parent

#11

What to build

Add parallel download worker-count configuration through all three config layers (YAML → Config dataclass → CLI → resolution).

Config changes:

  • Add workers: int = 3 field to the frozen Config dataclass in config.py
  • Add InvalidWorkersError(ConfigError) subclass for validation failures
  • Validate workers >= 1 in load_config(); reject 0 and negative values
  • Parse librofm.workers from the merged YAML dict (same pattern as existing fields like format, output_dir)

CLI changes:

  • Add --workers / -w argument to argparse in cli.py (type=int, metavar="N", default=0)
  • Document that default 0 means "use config value"

Resolution in run():

  • Three-layer priority: CLI flag (> 0?) → config.workers → hardcoded 3
  • Pass resolved worker count through to the download loop (for now, store it; slice 6 wires it to the orchestrator)

Acceptance criteria

  • Config.workers defaults to 3
  • workers: 5 in config.yaml produces Config(workers=5)
  • workers: 0 or workers: -1 in YAML raises InvalidWorkersError
  • --workers 8 on CLI resolves to 8 regardless of config.yaml value
  • No --workers flag uses config.yaml value; missing from both yields default 3
  • --workers 1 is accepted (sequential fallback)
  • 3–4 new tests in test_config.py covering default, YAML parse, validation rejection, CLI resolution

Blocked by

None - can start immediately

## Parent #11 ## What to build Add parallel download worker-count configuration through all three config layers (YAML → Config dataclass → CLI → resolution). **Config changes:** - Add `workers: int = 3` field to the frozen `Config` dataclass in `config.py` - Add `InvalidWorkersError(ConfigError)` subclass for validation failures - Validate `workers >= 1` in `load_config()`; reject 0 and negative values - Parse `librofm.workers` from the merged YAML dict (same pattern as existing fields like `format`, `output_dir`) **CLI changes:** - Add `--workers` / `-w` argument to argparse in `cli.py` (`type=int`, `metavar="N"`, `default=0`) - Document that default 0 means "use config value" **Resolution in `run()`:** - Three-layer priority: CLI flag (> 0?) → `config.workers` → hardcoded `3` - Pass resolved worker count through to the download loop (for now, store it; slice 6 wires it to the orchestrator) ## Acceptance criteria - [ ] `Config.workers` defaults to `3` - [ ] `workers: 5` in config.yaml produces `Config(workers=5)` - [ ] `workers: 0` or `workers: -1` in YAML raises `InvalidWorkersError` - [ ] `--workers 8` on CLI resolves to 8 regardless of config.yaml value - [ ] No `--workers` flag uses config.yaml value; missing from both yields default 3 - [ ] `--workers 1` is accepted (sequential fallback) - [ ] 3–4 new tests in `test_config.py` covering default, YAML parse, validation rejection, CLI resolution ## Blocked by None - can start immediately
AlexKucera commented 2026-06-03 17:04:22 +02:00 (Migrated from github.com)

Closed via commit d0b8a5d on feature/parallel-downloads

Closed via commit d0b8a5d on feature/parallel-downloads
Sign in to join this conversation.