18 lines
1.4 KiB
Python
18 lines
1.4 KiB
Python
import subprocess,json,pathlib
|
|
for name in ['comfyui-manju','huobao-comfy-gpu1','comfyui','h3-caption-gpu3-canary-8a5f','canvas-h3-prompt-normalizer-healthy-20261026']:
|
|
d=json.loads(subprocess.check_output(['docker','inspect',name],text=True))[0]
|
|
print(json.dumps({'name':name,'status':d['State']['Status'],'started':d['State']['StartedAt'],'restarts':d['RestartCount'],'oom_killed':d['State']['OOMKilled'],'image':d['Config']['Image'],'command':d['Config']['Cmd'][-10:]}))
|
|
if name=='comfyui-manju':
|
|
print('MOUNTS',json.dumps([{k:m.get(k) for k in ['Source','Destination']} for m in d['Mounts'] if 'history' in m.get('Destination','') or 'control' in m.get('Destination','')]))
|
|
r=subprocess.run(['docker','logs','--tail','160',name],capture_output=True,text=True)
|
|
lines=(r.stdout+r.stderr).replace('\r','\n').splitlines()
|
|
for line in lines:
|
|
if any(w.lower() in line.lower() for w in ['error','exception','traceback','Prompt executed','restor','%|','out of memory','starting server']):print(line[:400])
|
|
code='''import app,json,asyncio,httpx
|
|
async def main():
|
|
async with httpx.AsyncClient(timeout=15) as c:
|
|
p=app.providers()['gpu1_8189'];r=await c.get(p.base_url+'/history',headers=app.provider_headers(p));h=r.json()
|
|
print(json.dumps({'gpu1_history_count':len(h),'history_ids':list(h)[-12:]}))
|
|
asyncio.run(main())'''
|
|
print(subprocess.check_output(['docker','exec','canvas-h3-prompt-normalizer-healthy-20261026','python','-c',code],text=True))
|