Files
MeltMind/tools/s2_main_prepare.py
T

27 lines
1.1 KiB
Python

"""Geometry-only main adapter; all numerical preparation remains pinned and unchanged."""
import argparse
import json
from pathlib import Path
import s2_preprocess_pilot
from s2_recovery_supervisor import save
def run(root,index):
spec=json.loads((root/'contract.json').read_text())['cases'][index]
assert spec['attempt']['decode_labels'] is False
assert 'reuse_preparation' not in spec and 'prior_failed_preparation' not in spec
code=s2_preprocess_pilot.run(root,index)
if code:return code
dest=root/'parts'/spec['case'];r=json.loads((dest/'result.json').read_text())
assert r['label_arrays_decoded']==[] and r['status']=='COMPLETE'
assert not list(dest.rglob('*label*'))
if r['eligible_unique']<=0 or r['eligible_slots']<=0:
save(dest/'eligibility-failure.json',dict(status='NO_COMMON_ELIGIBLE_QUERIES',labels_decoded=False))
return 3
return 0
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('root',type=Path);p.add_argument('index',type=int);a=p.parse_args()
raise SystemExit(run(a.root,a.index))