comfyui_sd: fail fast when a checkpoint/LoRA isn't on the routed node

Checkpoints are no longer uniform across the fleet (M3 keeps only the
LoRA-compatible SD1.5 model; M1 holds the full SDXL archive). The gpu pool
routes by operator, not by checkpoint, so a job asking for bigLust could land
on a node without it. Query the node's own ComfyUI /object_info and exit with
the available list + where the rest lives, instead of a cryptic 400.
This commit is contained in:
m3ultra 2026-07-17 01:44:17 +10:00
parent 75ace36e00
commit 9c7164f77a

View File

@ -108,6 +108,30 @@ if LORA and ("xl" in CKPT.lower() or "biglust" in CKPT.lower() or "v2-1" in CKPT
print(f"WARNING: {LORA} is SD1.5 but {CKPT} is not — the LoRA will silently do nothing. "
f"Use Hyper_Realism_1.2_fp16.safetensors (see localmodels/README.md)", flush=True)
# Checkpoints are NOT identical across nodes (the M3 keeps only the LoRA-compatible
# SD1.5 model; the M1 holds the full SDXL archive). Ask this node's ComfyUI what it
# actually has and fail fast with a useful message rather than a cryptic 400.
try:
info = json.load(urllib.request.urlopen(f"{API}/object_info/CheckpointLoaderSimple"))
have = info["CheckpointLoaderSimple"]["input"]["required"]["ckpt_name"][0]
if CKPT not in have:
print(f"ERROR: '{CKPT}' is not on this node.\n"
f" available here: {', '.join(have) or '(none)'}\n"
f" The full SDXL set lives on the m1 node; every node has "
f"Hyper_Realism_1.2_fp16.safetensors (the only LoRA-compatible checkpoint).\n"
f" Fix: use a checkpoint listed above, or rsync it from m1.", flush=True)
sys.exit(1)
if LORA:
have_l = json.load(urllib.request.urlopen(f"{API}/object_info/LoraLoader"))
have_l = have_l["LoraLoader"]["input"]["required"]["lora_name"][0]
if LORA not in have_l:
print(f"ERROR: LoRA '{LORA}' is not on this node. available: {', '.join(have_l) or '(none)'}", flush=True)
sys.exit(1)
except SystemExit:
raise
except Exception as e:
print(f"(could not pre-check model availability: {e}) — continuing", flush=True)
body = json.dumps({"prompt": build(seed)}).encode()
req = urllib.request.Request(f"{API}/prompt", data=body, headers={"Content-Type": "application/json"})
try: