Load metadata.json from log directory and return Metadata object
(log_dir: Path)
| 355 | |
| 356 | |
| 357 | def load_metadata(log_dir: Path) -> Metadata: |
| 358 | """Load metadata.json from log directory and return Metadata object""" |
| 359 | metadata_file = log_dir / "metadata.json" |
| 360 | if not metadata_file.exists(): |
| 361 | return Metadata() |
| 362 | |
| 363 | try: |
| 364 | data = json.loads(metadata_file.read_text()) |
| 365 | return Metadata(data) |
| 366 | except (json.JSONDecodeError, OSError): |
| 367 | return Metadata() |
| 368 | |
| 369 | |
| 370 | def get_agent_info_from_metadata(metadata: Metadata) -> list[AgentInfo]: |
no test coverage detected