harness v1.0: fix blind du guard (timeout+defensive parse), 32GiB limit, 20s watchdog poll w/ reclaim, incremental per-row push
Browse files- scripts/verify.py +19 -8
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -32,6 +32,7 @@ v0.8: disk guard. Three rust jobs died on the 50G ephemeral-storage quota mid-ro
|
|
| 32 |
v0.9: java report files (surefire/gradle XML + gradle HTML) are collected and fed
|
| 33 |
to the parser; disk guard is du-based (container quota) and rust builds run under
|
| 34 |
a du watchdog so a runaway build kills the row, not the pod.
|
|
|
|
| 35 |
|
| 36 |
Usage (inside a job with the right language toolchain image):
|
| 37 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
|
@@ -46,7 +47,7 @@ MAX_CONTEXT_LINES = 1500
|
|
| 46 |
# The 50G limit is a per-container ephemeral-storage quota. df/statvfs report the
|
| 47 |
# host filesystem and never see it, so disk accounting must be du-based.
|
| 48 |
CONTAINER_QUOTA_BYTES = 50 * 1024**3
|
| 49 |
-
DU_LIMIT_BYTES =
|
| 50 |
RUST_SHARED_TARGET = "/tmp/pb-cargo-target"
|
| 51 |
|
| 52 |
LANG_PATH_PREPEND = {
|
|
@@ -90,11 +91,12 @@ def used_bytes():
|
|
| 90 |
"""Bytes used in the du-monitored dirs. df/statvfs see the host fs, not the
|
| 91 |
per-container ephemeral-storage quota, so du is the only honest measure."""
|
| 92 |
_, out, _ = run("du -sb /tmp /usr/local/cargo /root/.cache /var/tmp 2>/dev/null "
|
| 93 |
-
"| awk '{s+=$1} END {print s+0}'", "/tmp",
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
|
| 100 |
def log_disk(tag):
|
|
@@ -213,9 +215,10 @@ def watchdog_wrap(cmd):
|
|
| 213 |
f" if [ \"$used\" -gt {limit} ]; then\n"
|
| 214 |
" kill -9 -- -$pid 2>/dev/null\n"
|
| 215 |
" echo \"[DISK_WATCHDOG] killed build: container=${used}B\"\n"
|
|
|
|
| 216 |
" exit 0\n"
|
| 217 |
" fi\n"
|
| 218 |
-
" sleep
|
| 219 |
" done ) & mon=$!\n"
|
| 220 |
"wait $pid; rc=$?\n"
|
| 221 |
"kill $mon 2>/dev/null\n"
|
|
@@ -450,6 +453,14 @@ def main():
|
|
| 450 |
if row["language"] == "rust":
|
| 451 |
run(f"rm -rf {RUST_SHARED_TARGET}", "/tmp", 600)
|
| 452 |
done += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
for path, dest in [(out_path, f"pilot/results/{args.lang}.jsonl"),
|
| 455 |
(verified_path, f"pilot/verified/{args.lang}.jsonl")]:
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v1.0).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 32 |
v0.9: java report files (surefire/gradle XML + gradle HTML) are collected and fed
|
| 33 |
to the parser; disk guard is du-based (container quota) and rust builds run under
|
| 34 |
a du watchdog so a runaway build kills the row, not the pod.
|
| 35 |
+
v1.0: used_bytes() timed out on 40G+ du scans (empty output parsed as 0 => guard blind); limit lowered to 32GiB, watchdog polls 20s and reclaims on kill; results pushed to the Hub incrementally after each row so evictions lose at most one row.
|
| 36 |
|
| 37 |
Usage (inside a job with the right language toolchain image):
|
| 38 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
|
|
|
| 47 |
# The 50G limit is a per-container ephemeral-storage quota. df/statvfs report the
|
| 48 |
# host filesystem and never see it, so disk accounting must be du-based.
|
| 49 |
CONTAINER_QUOTA_BYTES = 50 * 1024**3
|
| 50 |
+
DU_LIMIT_BYTES = 32 * 1024**3
|
| 51 |
RUST_SHARED_TARGET = "/tmp/pb-cargo-target"
|
| 52 |
|
| 53 |
LANG_PATH_PREPEND = {
|
|
|
|
| 91 |
"""Bytes used in the du-monitored dirs. df/statvfs see the host fs, not the
|
| 92 |
per-container ephemeral-storage quota, so du is the only honest measure."""
|
| 93 |
_, out, _ = run("du -sb /tmp /usr/local/cargo /root/.cache /var/tmp 2>/dev/null "
|
| 94 |
+
"| awk '{s+=$1} END {print s+0}'", "/tmp", 900)
|
| 95 |
+
for line in reversed(out.splitlines()):
|
| 96 |
+
s = line.strip()
|
| 97 |
+
if s.isdigit():
|
| 98 |
+
return int(s)
|
| 99 |
+
return 0
|
| 100 |
|
| 101 |
|
| 102 |
def log_disk(tag):
|
|
|
|
| 215 |
f" if [ \"$used\" -gt {limit} ]; then\n"
|
| 216 |
" kill -9 -- -$pid 2>/dev/null\n"
|
| 217 |
" echo \"[DISK_WATCHDOG] killed build: container=${used}B\"\n"
|
| 218 |
+
" rm -rf /tmp/pb-cargo-target 2>/dev/null\n"
|
| 219 |
" exit 0\n"
|
| 220 |
" fi\n"
|
| 221 |
+
" sleep 20 >/dev/null 2>&1\n"
|
| 222 |
" done ) & mon=$!\n"
|
| 223 |
"wait $pid; rc=$?\n"
|
| 224 |
"kill $mon 2>/dev/null\n"
|
|
|
|
| 453 |
if row["language"] == "rust":
|
| 454 |
run(f"rm -rf {RUST_SHARED_TARGET}", "/tmp", 600)
|
| 455 |
done += 1
|
| 456 |
+
try:
|
| 457 |
+
api.upload_file(path_or_fileobj=out_path, path_in_repo=f"pilot/results/{args.lang}.jsonl",
|
| 458 |
+
repo_id=REPO_ID, repo_type="dataset", commit_message=f"pilot {args.lang}: incremental {done} rows")
|
| 459 |
+
if os.path.getsize(verified_path) > 0:
|
| 460 |
+
api.upload_file(path_or_fileobj=verified_path, path_in_repo=f"pilot/verified/{args.lang}.jsonl",
|
| 461 |
+
repo_id=REPO_ID, repo_type="dataset", commit_message=f"pilot {args.lang}: verified {done}")
|
| 462 |
+
except Exception as pe:
|
| 463 |
+
print(f"[push] incremental push failed: {pe}", flush=True)
|
| 464 |
|
| 465 |
for path, dest in [(out_path, f"pilot/results/{args.lang}.jsonl"),
|
| 466 |
(verified_path, f"pilot/verified/{args.lang}.jsonl")]:
|