verify.py v0.7: decode bytes stdout/stderr in TimeoutExpired (crashed slow maven builds at the 2100s timeout)
Browse files- scripts/verify.py +10 -3
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (v0.
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -25,6 +25,9 @@ Native (non-Docker) reproduction of the upstream env:
|
|
| 25 |
- rust: cargo target dirs are wiped between rows to stay inside the ephemeral
|
| 26 |
storage quota
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
Usage (inside a job with the right language toolchain image):
|
| 29 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 30 |
"""
|
|
@@ -57,8 +60,12 @@ def run(cmd, cwd, timeout):
|
|
| 57 |
timeout=timeout, text=True, errors="replace")
|
| 58 |
return p.returncode, (p.stdout or "") + (p.stderr or ""), time.time() - t0
|
| 59 |
except subprocess.TimeoutExpired as e:
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def sh(cmds, cwd, timeout=CMD_TIMEOUT_S):
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v0.7).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 25 |
- rust: cargo target dirs are wiped between rows to stay inside the ephemeral
|
| 26 |
storage quota
|
| 27 |
|
| 28 |
+
v0.7: TimeoutExpired.stdout/stderr can be bytes (python quirk under capture_output) --
|
| 29 |
+
decode before concatenating. This crashed slow maven builds at the 2100s timeout.
|
| 30 |
+
|
| 31 |
Usage (inside a job with the right language toolchain image):
|
| 32 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 33 |
"""
|
|
|
|
| 60 |
timeout=timeout, text=True, errors="replace")
|
| 61 |
return p.returncode, (p.stdout or "") + (p.stderr or ""), time.time() - t0
|
| 62 |
except subprocess.TimeoutExpired as e:
|
| 63 |
+
so, se = e.stdout or "", e.stderr or ""
|
| 64 |
+
if isinstance(so, bytes):
|
| 65 |
+
so = so.decode("utf-8", "replace")
|
| 66 |
+
if isinstance(se, bytes):
|
| 67 |
+
se = se.decode("utf-8", "replace")
|
| 68 |
+
return 124, so + se + f"\n[TIMEOUT after {timeout}s]", time.time() - t0
|
| 69 |
|
| 70 |
|
| 71 |
def sh(cmds, cwd, timeout=CMD_TIMEOUT_S):
|