Back to report index

Lanefinder (job config + wrappers) 3a6c762: AI3D-379 Read job config via shared load_json_overrides

Miroslav Simko <ms@iolabs.ch> 2026-09-02T11:50:10+02:00

Commit #9 · 3 snippets

 src/pipeline/job_config.py | 8 +-------
 test/test_job_config.py    | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)
Importance #1: src/pipeline/job_config.py @@ -84,15 +84,9 @@
84 directory. Malformed JSON, missing required keys and unknown top-level84 directory. Malformed JSON, missing required keys and unknown top-level
85 keys all raise :class:`JobConfigError` (a :class:`ValueError`).85 keys all raise :class:`JobConfigError` (a :class:`ValueError`).
86 """86 """
87 path = Path(path)87 path = Path(path)
88 try:88 raw = config_loader.load_json_overrides(path, error_cls=JobConfigError)
89 raw = json.loads(path.read_text(encoding="utf-8"))
90 except json.JSONDecodeError as exc:
91 raise JobConfigError(f"Job config {path} is not valid JSON: {exc}") from exc
92
93 if not isinstance(raw, dict):
94 raise JobConfigError(f"Job config {path} must be a JSON object")
9589
96 cfg = config_loader.validate_config(90 cfg = config_loader.validate_config(
97 JobConfig,91 JobConfig,
98 raw,92 raw,
Importance #2: test/test_job_config.py @@ -269,9 +269,9 @@
269def test_load_job_config_rejects_malformed_json(tmp_path: Path) -> None:269def test_load_job_config_rejects_malformed_json(tmp_path: Path) -> None:
270 cfg_path = tmp_path / "job.json"270 cfg_path = tmp_path / "job.json"
271 cfg_path.write_text("{not json", encoding="utf-8")271 cfg_path.write_text("{not json", encoding="utf-8")
272272
273 with pytest.raises(job_config.JobConfigError, match="not valid JSON"):273 with pytest.raises(job_config.JobConfigError, match="Invalid JSON"):
274 job_config.load_job_config(cfg_path)274 job_config.load_job_config(cfg_path)
275275
276276
277def test_load_job_config_rejects_unknown_device(tmp_path: Path) -> None:277def test_load_job_config_rejects_unknown_device(tmp_path: Path) -> None:
Importance #3: test/test_job_config.py @@ -269,9 +269,9 @@
269def test_load_job_config_rejects_malformed_json(tmp_path: Path) -> None:269def test_load_job_config_rejects_malformed_json(tmp_path: Path) -> None:
270 cfg_path = tmp_path / "job.json"270 cfg_path = tmp_path / "job.json"
271 cfg_path.write_text("{not json", encoding="utf-8")271 cfg_path.write_text("{not json", encoding="utf-8")
272272
273 with pytest.raises(job_config.JobConfigError, match="not valid JSON"):273 with pytest.raises(job_config.JobConfigError, match="Invalid JSON"):
274 job_config.load_job_config(cfg_path)274 job_config.load_job_config(cfg_path)
275275
276276
277def test_load_job_config_rejects_unknown_device(tmp_path: Path) -> None:277def test_load_job_config_rejects_unknown_device(tmp_path: Path) -> None: