import subprocess,json,pathlib root=pathlib.Path('/home/ps/huobao-gpu-selection') code='''import asyncio,httpx,json,app async def main(): result={} async with httpx.AsyncClient(timeout=30) as c: graph=json.load(open('/app/workflows/vdn_hd.json')) for p in app.providers().values(): r=await c.get(p.base_url+'/object_info',headers=app.provider_headers(p));r.raise_for_status();nodes=r.json() missing=[] for node in graph.values(): typ=node['class_type'] if typ not in nodes:missing.append(typ);continue fields={**nodes[typ].get('input',{}).get('required',{}),**nodes[typ].get('input',{}).get('optional',{})} for key,val in node['inputs'].items(): options=fields.get(key,[]) if options and isinstance(options[0],list) and isinstance(val,str): choices=[x.get('key') if isinstance(x,dict) else x for x in options[0]] if val not in choices:missing.append(typ+':'+key+':'+val) q=(await c.get(p.base_url+'/queue',headers=app.provider_headers(p))).json() result[p.id]={'nodes':len(nodes),'vdn_missing':missing,'running':len(q.get('queue_running',[])),'pending':len(q.get('queue_pending',[]))} print(json.dumps(result)) asyncio.run(main()) ''' out=subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',code],text=True) data=json.loads(out);(root/'three-gpu-preflight.json').write_text(json.dumps(data,indent=2));print(out) assert set(data)=={'default','gpu1','gpu3'} assert all(not d['vdn_missing'] for d in data.values()),'VDN preflight failed' # Verify histories imported before restoring GPU3 admission. meta=json.loads((root/'gpu3-vdn/created.json').read_text()) history_code='''import asyncio,httpx,app async def main(): p=app.providers()['gpu3'] async with httpx.AsyncClient(timeout=20) as c: r=await c.get(p.base_url+'/history',headers=app.provider_headers(p));r.raise_for_status();print(len(r.json())) asyncio.run(main()) ''' count=int(subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',history_code],text=True)) assert count>=meta['history_count'] print('GPU3 history preserved:',count)