|
33 | 33 | import json |
34 | 34 | import logging |
35 | 35 | import os |
| 36 | +import subprocess |
36 | 37 | import sys |
37 | 38 | from pathlib import Path |
38 | 39 | from typing import Any |
@@ -215,6 +216,7 @@ def _parse_args(argv: list[str]) -> argparse.Namespace: |
215 | 216 | parser.add_argument("--shard-index", type=int, default=0) |
216 | 217 | parser.add_argument("--ground-truth", action="store_true") |
217 | 218 | parser.add_argument("--fail-on-unresolved", action="store_true") |
| 219 | + parser.add_argument("--rmi-after", action="store_true") |
218 | 220 | parser.add_argument("--concurrency", type=int, default=1) |
219 | 221 | parser.add_argument("--openai-base-url", default=os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1")) |
220 | 222 | parser.add_argument("--openai-api-key", default=os.environ.get("OPENAI_API_KEY", "")) |
@@ -279,10 +281,19 @@ async def main(argv: list[str] | None = None) -> int: |
279 | 281 | out_dir = Path(args.out) |
280 | 282 | out_dir.mkdir(parents=True, exist_ok=True) |
281 | 283 |
|
| 284 | + # Instance images are per-instance and never reused within a run; |
| 285 | + # on CI runners, keeping ~25 of them exhausts the disk mid-shard. |
| 286 | + images = {str(row["instance_id"]): dataset.image(row) for row in rows} |
| 287 | + |
282 | 288 | def _persist(rollout: Any) -> None: |
283 | 289 | (out_dir / f"{rollout.instance_id}.json").write_text(json.dumps(rollout.to_dict(), indent=2)) |
284 | 290 | verdict = "PASS" if rollout.resolved else (rollout.skipped or rollout.error or "FAIL") |
285 | 291 | print(f"[{rollout.instance_id}] {verdict} ({rollout.duration_s:.1f}s)") |
| 292 | + if args.rmi_after and rollout.instance_id in images: |
| 293 | + subprocess.run( |
| 294 | + ["docker", "rmi", "-f", images[rollout.instance_id]], |
| 295 | + capture_output=True, |
| 296 | + ) |
286 | 297 |
|
287 | 298 | print(f"selected {len(rows)} instance(s) (concurrency={args.concurrency}, ground_truth={args.ground_truth})") |
288 | 299 | rollouts = await run_rollouts( |
|
0 commit comments