#!/usr/bin/env python3 """Check the six-subset expansion locally, or smoke-test each hard family in Docker.""" import argparse,sys from concurrent.futures import ThreadPoolExecutor from pathlib import Path sys.path.insert(0,str(Path(__file__).resolve().parent)) import check_tasks BATCH={'habitat-survey','food-batch','textile-lab','grower-desk','fishery-log','sanitation-desk'} def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--docker',action='store_true');args=parser.parse_args() ts=[t for t in check_tasks.tasks() if t['env'] in BATCH] if len(ts)!=648:raise SystemExit('Expected exactly 648 expansion tasks; rebuild first') if args.docker: seen=set();bad=0 for t in ts: key=(t['env'],t['family']) if key in seen or t['difficulty']!=3:continue seen.add(key);a,b,error=check_tasks.docker(t);ok=(a,b)==(0.,1.);bad+=not ok print(('ok' if ok else 'FAIL'),t['id'],'no-op',a,'oracle',b,error,flush=True) print(len(seen),'hard-task Docker checks,',bad,'failures') return 1 if bad or len(seen)!=18 else 0 def run(t): result=check_tasks.local(t) if result!=(0.,1.):print('FAIL',t['id'],result,flush=True);return False return True with ThreadPoolExecutor(max_workers=4) as pool:results=list(pool.map(run,ts)) print(len(ts),'new exported tasks checked,',results.count(False),'failures') return 0 if all(results) else 1 if __name__=='__main__':sys.exit(main())