#!/usr/bin/env python3 """Two-time real preprocessing check; never runs REAL/WRF/RegCM integration.""" import sys sys.dont_write_bytecode=True import json import rcms from pathlib import Path model=sys.argv[1] cfg=json.loads((rcms.HERE/'config.json').read_text()) cfg['operational_layout'] = False # Smoke fixtures must stay inside workspace. end,entries=rcms.inventory(cfg,'2026082100','2026082106') root=rcms.HERE/'test-results'/(model+'-preprocess-'+rcms.stamp());root.mkdir(parents=True) print('Retained preprocessing sample:',root,flush=True) class StopBeforeModel(Exception): pass class PreprocessRunner(rcms.Runner): def run(self,args,cwd=None): if str(args[0]) in ['mpirun','srun']: raise StopBeforeModel('Intentional stop before integration') return super().run(args,cwd) man={'config':cfg,'cycle':'2026082100','end':end,'inputs':entries,'tasks':{'wrf':40,'regcm':20}} r=PreprocessRunner(root,cfg['utilities']) try: (rcms.wrf_integrate if model=='wrf' else rcms.regcm_integrate)(man,root,r) except StopBeforeModel: assert (root/'PREPROCESS_SUCCESS.json').exists() rcms.put(root/'SMOKE_SUCCESS.json',{'model':model,'note':'Preprocessing passed; no integration run'}) print('Preprocessing smoke SUCCESS (integration not run)',flush=True) except Exception as exc: rcms.put(root/'SMOKE_FAILED.json',{'error':str(exc)}) raise