harness v1.1: cargo debuginfo stripped + target-dir-scoped watchdog
Browse files- scripts/verify.py +12 -3
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (v1.
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -34,6 +34,8 @@ to the parser; disk guard is du-based (container quota) and rust builds run unde
|
|
| 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
|
| 39 |
"""
|
|
@@ -49,6 +51,7 @@ MAX_CONTEXT_LINES = 1500
|
|
| 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 = {
|
| 54 |
"go": ["/usr/local/go/bin"],
|
|
@@ -210,9 +213,9 @@ def watchdog_wrap(cmd):
|
|
| 210 |
f"printf %s {q} > /tmp/pb_cmd.sh\n"
|
| 211 |
"setsid bash /tmp/pb_cmd.sh & pid=$!\n"
|
| 212 |
"( while kill -0 $pid 2>/dev/null; do\n"
|
| 213 |
-
" used=$(du -sb /tmp
|
| 214 |
"| awk '{s+=$1} END {print s+0}')\n"
|
| 215 |
-
f" if [ \"$used\" -gt {
|
| 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"
|
|
@@ -337,6 +340,12 @@ def verify_row(row, lang):
|
|
| 337 |
|
| 338 |
if lang == "rust":
|
| 339 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
os.environ["PATH"] = ":".join(LANG_PATH_PREPEND.get(lang, [])) + ":" + os.environ["PATH"]
|
| 341 |
def tb(cmds):
|
| 342 |
return [c.replace(TESTBED, repo_dir) for c in (cmds or [])]
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v1.1).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 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 |
+
v1.1: one dev-profile cargo build grew the shared target dir 6.7G->43G and evicted the pod before the watchdog's du scan could catch it. Fixed both causes: cargo now strips debuginfo and disables incremental compilation in dev/test profiles (no effect on test outcomes, cuts target-dir size several-fold); the in-run watchdog monitors only /tmp/pb-cargo-target (fast du scans even under pressure) at a 20GiB limit instead of scanning all of /tmp at 32GiB.
|
| 38 |
+
|
| 39 |
Usage (inside a job with the right language toolchain image):
|
| 40 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 41 |
"""
|
|
|
|
| 51 |
CONTAINER_QUOTA_BYTES = 50 * 1024**3
|
| 52 |
DU_LIMIT_BYTES = 32 * 1024**3
|
| 53 |
RUST_SHARED_TARGET = "/tmp/pb-cargo-target"
|
| 54 |
+
RUST_WATCHDOG_LIMIT_BYTES = 20 * 1024**3 # watchdog limit on the target dir alone
|
| 55 |
|
| 56 |
LANG_PATH_PREPEND = {
|
| 57 |
"go": ["/usr/local/go/bin"],
|
|
|
|
| 213 |
f"printf %s {q} > /tmp/pb_cmd.sh\n"
|
| 214 |
"setsid bash /tmp/pb_cmd.sh & pid=$!\n"
|
| 215 |
"( while kill -0 $pid 2>/dev/null; do\n"
|
| 216 |
+
" used=$(du -sb /tmp/pb-cargo-target 2>/dev/null "
|
| 217 |
"| awk '{s+=$1} END {print s+0}')\n"
|
| 218 |
+
f" if [ \"$used\" -gt {RUST_WATCHDOG_LIMIT_BYTES} ]; then\n"
|
| 219 |
" kill -9 -- -$pid 2>/dev/null\n"
|
| 220 |
" echo \"[DISK_WATCHDOG] killed build: container=${used}B\"\n"
|
| 221 |
" rm -rf /tmp/pb-cargo-target 2>/dev/null\n"
|
|
|
|
| 340 |
|
| 341 |
if lang == "rust":
|
| 342 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
| 343 |
+
# v1.1: a dev-profile build with debuginfo hit 43G on the 50G container
|
| 344 |
+
# quota. Stripping debuginfo and disabling incremental compilation has
|
| 345 |
+
# no effect on test outcomes, only on build artifacts.
|
| 346 |
+
os.environ["CARGO_PROFILE_DEV_DEBUG"] = "0"
|
| 347 |
+
os.environ["CARGO_PROFILE_TEST_DEBUG"] = "0"
|
| 348 |
+
os.environ["CARGO_INCREMENTAL"] = "0"
|
| 349 |
os.environ["PATH"] = ":".join(LANG_PATH_PREPEND.get(lang, [])) + ":" + os.environ["PATH"]
|
| 350 |
def tb(cmds):
|
| 351 |
return [c.replace(TESTBED, repo_dir) for c in (cmds or [])]
|