#!/usr/bin/env python3
"""Check full log after sampling for VAE decode status."""
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.178.150', username='fabian', key_filename=r'C:\Users\fabia\.ssh\id_ed25519')
def run(cmd):
    _, so, se = ssh.exec_command(cmd, timeout=15)
    return so.read().decode()

# Get more log lines - look for everything after the sampling
print("=== FULL LOG (last 60 lines) ===")
print(run("tail -60 /home/fabian/comfyui.log 2>/dev/null"))

# Check output directory
print("\n=== OUTPUT FILES ===")
print(run("ls -lah /home/fabian/ComfyUI/output/ 2>/dev/null"))

# Queue status
print("=== QUEUE ===")
print(run("curl -s http://localhost:8188/queue 2>/dev/null"))

# History
print("\n=== HISTORY ===")
print(run("curl -s http://localhost:8188/history 2>/dev/null")[:2000])

# Process count and wchan
print("\n=== PROCESS STATE ===")
print(run("bash -c 'PID=$(pgrep -f \"python3 main.py\" | head -1); "
    "cat /proc/$PID/wchan 2>/dev/null; echo; "
    "ps -L -p $PID -o tid,%cpu,comm --sort=-%cpu 2>/dev/null | head -20'"))

ssh.close()
