sidrefresh's picture
Add files using upload-large-folder tool
7ec48b5 verified
Raw History Blame Contribute Delete
1.61 kB
#!/usr/bin/env bash
set -euo pipefail
test_dir="$(cd "$(dirname "$0")" && pwd)"
HOME=/home/rct2 DISPLAY=:1 python3 /usr/local/lib/t39/collect.py --screenshot || true
mkdir -p /logs/verifier
rm -f /logs/verifier/reward.txt /logs/verifier/reward.json
# The controller saves the park at the moment an attempt settles, one file per
# attempt; the newest of those is the proof, and the newest save of any kind
# stands in when no attempt ever settled.
park="$(python3 - <<'PY'
from pathlib import Path
root = Path('/logs/artifacts/save')
# onetile-base.park is the pristine plot the run was launched from and
# 2nd-try.park and 3rd-try.park are the pristine copies the further attempts are
# taken from, all kept in the save directory so the agent's dialogs open usefully.
# None of them is evidence about this run.
pristine = {'onetile-base.park', '2nd-try.park', '3rd-try.park'}
parks = [p for p in root.rglob('*.park')
if p.name not in pristine] if root.is_dir() else []
settled = [p for p in parks if p.name.startswith('t39-final')]
if settled:
print(max(settled, key=lambda p: p.stat().st_mtime))
elif parks:
print(max(parks, key=lambda p: p.stat().st_mtime))
PY
)"
args=()
if [[ -n "$park" ]]; then
reopened=/logs/verifier/reopened.json
if ! python3 "$test_dir/reopen.py" "$park" "$reopened" \
>> /logs/verifier/reopen.log 2>&1; then
echo "Native save could not be inspected; see reopen.log." \
> /logs/verifier/evaluation-error.txt
exit 2
fi
args+=(--saved-state "$reopened")
fi
python3 "$test_dir/grade.py" ${args[@]+"${args[@]}"}