Function
_run_harness
(
*,
swebench_repo: Path,
swebench_python: str,
dataset_name: str,
split: str,
predictions_path: Path,
instance_ids: list[str] | None,
run_id: str,
max_workers: int,
log_path: Path,
)
Source from the content-addressed store, hash-verified
| 577 | |
| 578 | |
| 579 | def _run_harness( |
| 580 | *, |
| 581 | swebench_repo: Path, |
| 582 | swebench_python: str, |
| 583 | dataset_name: str, |
| 584 | split: str, |
| 585 | predictions_path: Path, |
| 586 | instance_ids: list[str] | None, |
| 587 | run_id: str, |
| 588 | max_workers: int, |
| 589 | log_path: Path, |
| 590 | ) -> None: |
| 591 | cmd = [ |
| 592 | swebench_python, |
| 593 | "-m", |
| 594 | "swebench.harness.run_evaluation", |
| 595 | "--dataset_name", |
| 596 | dataset_name, |
| 597 | "--split", |
| 598 | split, |
| 599 | "--predictions_path", |
| 600 | str(predictions_path), |
| 601 | "--max_workers", |
| 602 | str(max_workers), |
| 603 | "--run_id", |
| 604 | run_id, |
| 605 | ] |
| 606 | if instance_ids: |
| 607 | cmd.extend(["--instance_ids", *instance_ids]) |
| 608 | _info(f" harness: {predictions_path.name} (run_id={run_id})") |
| 609 | log_path.parent.mkdir(parents=True, exist_ok=True) |
| 610 | try: |
| 611 | with log_path.open("wb") as log_handle: |
| 612 | subprocess.run( # noqa: S603 |
| 613 | cmd, |
| 614 | cwd=str(swebench_repo), |
| 615 | check=True, |
| 616 | stdout=log_handle, |
| 617 | stderr=subprocess.STDOUT, |
| 618 | ) |
| 619 | except subprocess.CalledProcessError as e: |
| 620 | _info( |
| 621 | f"harness subprocess failed (exit {e.returncode}). " |
| 622 | f"Later agents were not started. Full log: {log_path}" |
| 623 | ) |
| 624 | raise |
| 625 | |
| 626 | |
| 627 | def _find_summary(swebench_repo: Path, model_name: str, run_id: str) -> Path: |
Tested by
no test coverage detected