(job: Job)
| 363 | |
| 364 | |
| 365 | def _scan_artifacts(job: Job) -> None: |
| 366 | output_dir = job.output_dir |
| 367 | candidates = [ |
| 368 | output_dir / "figure.png", |
| 369 | output_dir / "samed.png", |
| 370 | output_dir / "template.svg", |
| 371 | output_dir / "final.svg", |
| 372 | ] |
| 373 | |
| 374 | icons_dir = output_dir / "icons" |
| 375 | if icons_dir.is_dir(): |
| 376 | candidates.extend(icons_dir.glob("icon_*.png")) |
| 377 | |
| 378 | for path in candidates: |
| 379 | if not path.is_file(): |
| 380 | continue |
| 381 | rel_path = path.relative_to(output_dir).as_posix() |
| 382 | if rel_path in job.seen: |
| 383 | continue |
| 384 | job.seen.add(rel_path) |
| 385 | |
| 386 | kind = _classify_artifact(rel_path) |
| 387 | job.push( |
| 388 | "artifact", |
| 389 | { |
| 390 | "kind": kind, |
| 391 | "name": path.name, |
| 392 | "path": rel_path, |
| 393 | "url": f"/api/artifacts/{job.job_id}/{rel_path}", |
| 394 | }, |
| 395 | ) |
| 396 | |
| 397 | |
| 398 | def _classify_artifact(rel_path: str) -> str: |
no test coverage detected