turkic-ocr-code / scripts /r5_selftest.sbatch
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
1.26 kB
#!/bin/bash
#SBATCH --job-name=r5_selftest
#SBATCH --partition=ZEN4
#SBATCH --qos=nu-zen4
#SBATCH --gres=none
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --time=00:30:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# R5 EVALCODE: runs every unit test of r5eval on a compute node (synthetic data only; scratch under DATA/tmp/evalcode_selftest).
C=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
PY=$C/.venv_kraken/bin/python
# R5_STAGE (optional): a staged copy (folders src/, scripts/, tests/) to test before a deploy: sbatch --export=ALL,R5_STAGE=$C/_stage_check r5_selftest.sbatch
if [ -n "$R5_STAGE" ]; then S=$R5_STAGE; T=$S/tests; W=$D/tmp/evalcode_selftest_stage; else S=$C; T=$C/tests_r5eval; W=$D/tmp/evalcode_selftest; fi
echo "code under test: $S"
mkdir -p $W
rc=0
cd $T
$PY -I test_scorelib_j2_unchanged.py $S/src/r5eval/frozen/scorelib_j2.py || rc=1
for t in test_core test_pages test_ktrain test_curve; do $PY -I $t.py || rc=1; done
$PY -I test_cli.py $W/cli || rc=1
$PY -I test_verdict.py $W/verdict || rc=1
if [ -f $T/test_report_cards.py ]; then $PY -I test_report_cards.py $W/cards || rc=1; fi
if [ -f $T/test_leaders.py ]; then $PY -I test_leaders.py $W/leaders || rc=1; fi
echo "selftest exit code $rc"
exit $rc