chore: merge the autorun runner and jobs

This commit is contained in:
Abdessamad Derraz committed 2026-10-27 10:41:53 +01:00
commit 07c34781e7
10 files changed
+2900 -2

No files matched your search

+22 -1
View File
@@ -41,6 +41,7 @@ Usage:
python scripts/refresh_stale.py --dry-run
python scripts/refresh_stale.py --only platforms,targets
python scripts/refresh_stale.py --jobs 6
python scripts/refresh_stale.py --findings tmp/freshness.json --only data
"""
from __future__ import annotations
@@ -156,6 +157,17 @@ def _run_check_freshness(areas: tuple[str, ...], extra: list[str]) -> list[dict]
raise RuntimeError(f"check_freshness.py returned unreadable JSON: {exc}") from exc
def load_findings(path: Path, areas: tuple[str, ...]) -> list[dict]:
"""A saved check_freshness.py --json report, kept to the asked areas."""
try:
findings = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise RuntimeError(f"cannot read findings from {path}: {exc}") from exc
if not isinstance(findings, list):
raise RuntimeError(f"{path} is not a check_freshness.py --json report")
return [f for f in findings if f.get("area") in areas]
def _slug(subject: str) -> str:
"""A safe filename stem for a finding's subject."""
return re.sub(r"[^A-Za-z0-9_.-]+", "_", subject).strip("_") or "job"
@@ -557,6 +569,12 @@ def main() -> int:
action="store_true",
help="machine-readable summary (jobs, surfaced, ignored)",
)
parser.add_argument(
"--findings",
metavar="FILE",
help="read the check_freshness.py --json report from FILE instead of "
"running it (rows outside --only are left out)",
)
parser.add_argument(
"--freshness-arg",
action="append",
@@ -577,7 +595,10 @@ def main() -> int:
areas = all_areas
try:
findings = _run_check_freshness(areas, args.freshness_arg)
if args.findings:
findings = load_findings(Path(args.findings), areas)
else:
findings = _run_check_freshness(areas, args.freshness_arg)
except RuntimeError as exc:
print(exc, file=sys.stderr)
return 2