Spaces:
Sleeping
Sleeping
Fix full validator cross-platform inference log handling
Browse files
scripts/pre_submit_validate.sh
CHANGED
|
@@ -19,6 +19,7 @@ PYTHON_BIN=""
|
|
| 19 |
OPENENV_BIN=""
|
| 20 |
OPENENV_USE_MODULE=false
|
| 21 |
DOCKER_CONTAINER_ID=""
|
|
|
|
| 22 |
|
| 23 |
usage() {
|
| 24 |
cat <<'EOF'
|
|
@@ -74,6 +75,7 @@ cleanup() {
|
|
| 74 |
if [ -n "$DOCKER_CONTAINER_ID" ]; then
|
| 75 |
docker rm -f "$DOCKER_CONTAINER_ID" >/dev/null 2>&1 || true
|
| 76 |
fi
|
|
|
|
| 77 |
}
|
| 78 |
|
| 79 |
trap cleanup EXIT
|
|
@@ -297,8 +299,8 @@ log "Step 7/8: Baseline reproducibility (inference.py)"
|
|
| 297 |
if [ "$SKIP_INFERENCE" = true ]; then
|
| 298 |
log "SKIPPED -- --skip-inference enabled"
|
| 299 |
else
|
| 300 |
-
run_with_timeout "$INFERENCE_TIMEOUT" "$PYTHON_BIN" inference.py >
|
| 301 |
-
tail -n 80
|
| 302 |
die "inference.py failed or timed out"
|
| 303 |
}
|
| 304 |
pass "inference.py completed within timeout"
|
|
@@ -308,12 +310,12 @@ log "Step 8/8: Structured logs + task/grader checks"
|
|
| 308 |
if [ "$SKIP_INFERENCE" = true ]; then
|
| 309 |
log "SKIPPED -- --skip-inference enabled"
|
| 310 |
else
|
| 311 |
-
"$PYTHON_BIN" - <<'PY'
|
| 312 |
import json
|
| 313 |
import sys
|
| 314 |
from pathlib import Path
|
| 315 |
|
| 316 |
-
path = Path(
|
| 317 |
text = path.read_text(encoding='utf-8', errors='replace').splitlines()
|
| 318 |
|
| 319 |
starts = []
|
|
|
|
| 19 |
OPENENV_BIN=""
|
| 20 |
OPENENV_USE_MODULE=false
|
| 21 |
DOCKER_CONTAINER_ID=""
|
| 22 |
+
INFERENCE_OUT_FILE=".pre-submit-inference.out"
|
| 23 |
|
| 24 |
usage() {
|
| 25 |
cat <<'EOF'
|
|
|
|
| 75 |
if [ -n "$DOCKER_CONTAINER_ID" ]; then
|
| 76 |
docker rm -f "$DOCKER_CONTAINER_ID" >/dev/null 2>&1 || true
|
| 77 |
fi
|
| 78 |
+
rm -f "$INFERENCE_OUT_FILE" >/dev/null 2>&1 || true
|
| 79 |
}
|
| 80 |
|
| 81 |
trap cleanup EXIT
|
|
|
|
| 299 |
if [ "$SKIP_INFERENCE" = true ]; then
|
| 300 |
log "SKIPPED -- --skip-inference enabled"
|
| 301 |
else
|
| 302 |
+
run_with_timeout "$INFERENCE_TIMEOUT" "$PYTHON_BIN" inference.py >"$INFERENCE_OUT_FILE" 2>&1 || {
|
| 303 |
+
tail -n 80 "$INFERENCE_OUT_FILE"
|
| 304 |
die "inference.py failed or timed out"
|
| 305 |
}
|
| 306 |
pass "inference.py completed within timeout"
|
|
|
|
| 310 |
if [ "$SKIP_INFERENCE" = true ]; then
|
| 311 |
log "SKIPPED -- --skip-inference enabled"
|
| 312 |
else
|
| 313 |
+
"$PYTHON_BIN" - "$INFERENCE_OUT_FILE" <<'PY'
|
| 314 |
import json
|
| 315 |
import sys
|
| 316 |
from pathlib import Path
|
| 317 |
|
| 318 |
+
path = Path(sys.argv[1])
|
| 319 |
text = path.read_text(encoding='utf-8', errors='replace').splitlines()
|
| 320 |
|
| 321 |
starts = []
|