"""Model-free adapter: readiness requires a real fixed-schedule warmup image.""" import hashlib, io, json, os, pathlib, runpy, sys, threading, time, urllib.request from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer # The producer places reference_workflow.py beside this adapter. LPK injection # evaluates that source first in this namespace, before executing this module. STATE={'ready':False,'model':MODEL,'schedule':list(SIGMAS),'phase':'starting'} PORT=int(os.environ.get('AIPOD_COMFY_PORT','8188')) READY_PORT=int(os.environ.get('AIPOD_READY_PORT','8190')) BASE='http://127.0.0.1:'+str(PORT) def request(path,body=None): data=None if body is None else json.dumps(body).encode() req=urllib.request.Request(BASE+path,data=data,headers={'Content-Type':'application/json'}) with urllib.request.urlopen(req,timeout=30) as response:return json.loads(response.read()) def warmup(): deadline=time.monotonic()+1800 try: while time.monotonic()