Download research/run_all.py from PureOne/LIORAEN-Omega: direct link, hf CLI and curl.
- Browser
- Download file 3.52 kB
-
https://huggingface.co/datasets/PureOne/LIORAEN-Omega/resolve/main/research/run_all.py
- Command line
-
hf download hf://datasets/PureOne/LIORAEN-Omega/research/run_all.py
-
curl -L -o run_all.py https://huggingface.co/datasets/PureOne/LIORAEN-Omega/resolve/main/research/run_all.py
3.52 kB
| """Run every delivered computational check without network access.""" | |
| from __future__ import annotations | |
| import argparse,contextlib,io,json,os,pathlib,runpy,sys,tempfile,time,zipfile | |
| ROOT=pathlib.Path(__file__).resolve().parent | |
| ENV=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',MKL_NUM_THREADS='1',PYTHONHASHSEED='0',MPLBACKEND='Agg') | |
| REPORT={'all_passed':False,'steps':[]} | |
| def run(name,script,cwd=ROOT): | |
| """Run isolated script globals while reusing expensive library imports.""" | |
| start=time.perf_counter();stream=io.StringIO();old_cwd=pathlib.Path.cwd() | |
| old_argv=sys.argv[:];failure=None | |
| try: | |
| os.chdir(cwd);os.environ.update(ENV);sys.argv=[str(script)] | |
| with contextlib.redirect_stdout(stream),contextlib.redirect_stderr(stream): | |
| runpy.run_path(str(pathlib.Path(cwd)/script),run_name='__main__') | |
| except SystemExit as exc: | |
| if exc.code not in (None,0):failure=exc | |
| except BaseException as exc: | |
| failure=exc | |
| finally: | |
| os.chdir(old_cwd);sys.argv=old_argv | |
| (ROOT/'results'/f'{name}.txt').write_text(stream.getvalue(),encoding='utf-8') | |
| REPORT['steps'].append({'name':name,'returncode':0 if failure is None else 1, | |
| 'elapsed_seconds':time.perf_counter()-start,'execution':'isolated runpy globals; shared import cache'}) | |
| (ROOT/'results/run_all_report.json').write_text(json.dumps(REPORT,indent=2)+'\n') | |
| print(f"{name}: {'PASS' if failure is None else 'FAIL'}",flush=True) | |
| if failure is not None:raise RuntimeError(f'{name} failed; inspect results/{name}.txt') from failure | |
| def main(): | |
| parser=argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--all',action='store_true',help='also regenerate figures/data and rerun the supplied predecessor') | |
| args=parser.parse_args() | |
| REPORT['extended_checks_selected']=args.all | |
| (ROOT/'results').mkdir(exist_ok=True) | |
| try: | |
| run('core_verification','tests/verify.py') | |
| run('supplement_verification','tests/verify_supplement.py') | |
| if args.all: | |
| run('synthetic_data_generation','src/make_data.py') | |
| with tempfile.TemporaryDirectory(prefix='lioraen_original_') as temporary: | |
| destination=pathlib.Path(temporary).resolve() | |
| with zipfile.ZipFile(ROOT/'provenance/SUPPLIED_NAEVORA_IX.zip') as z: | |
| if z.testzip() is not None:raise RuntimeError('source archive failed CRC') | |
| for info in z.infolist(): | |
| candidate=(destination/info.filename).resolve() | |
| if not candidate.is_relative_to(destination): | |
| raise RuntimeError('unsafe source archive path') | |
| z.extractall(destination) | |
| logs=[] | |
| for short in ['run_verification','extra_verification','coded_verification','exact_symbolic']: | |
| name='predecessor_'+short | |
| run(name,'tests/'+short+'.py',destination) | |
| logs.append('== '+short+' ==\n'+(ROOT/'results'/f'{name}.txt').read_text()) | |
| (ROOT/'results/predecessor_regression.txt').write_text('\n'.join(logs)+'\nALL FOUR TEST PROGRAMS PASSED\n') | |
| REPORT['all_passed']=True | |
| finally: | |
| (ROOT/'results/run_all_report.json').write_text(json.dumps(REPORT,indent=2)+'\n') | |
| print('All selected checks passed. Separate delivered logs record the physics generation and predecessor regressions.') | |
| if __name__=='__main__':main() | |