21 lines
1.2 KiB
Python
21 lines
1.2 KiB
Python
import subprocess,json
|
|
code='''import asyncio,httpx,json,app
|
|
async def main():
|
|
async with httpx.AsyncClient(timeout=15) as c:
|
|
for p in app.providers().values():
|
|
q=(await c.get(p.base_url+'/queue',headers=app.provider_headers(p))).json()
|
|
stats=(await c.get(p.base_url+'/system_stats',headers=app.provider_headers(p))).json()
|
|
print(json.dumps({'worker':p.id,'running':[x[1] for x in q.get('queue_running',[])],'pending':len(q.get('queue_pending',[])),'torch_vram':sum(x.get('torch_vram_total',0) for x in stats.get('devices',[]))}))
|
|
for key in ('default','gpu1_8189','gpu3'):
|
|
try:
|
|
p=await app.select_provider(key,True,True)
|
|
print(json.dumps({'selected':key,'url':p.base_url,'ready':True}))
|
|
except Exception as e:print(json.dumps({'selected':key,'ready':False,'detail':str(getattr(e,'detail',e))}))
|
|
asyncio.run(main())
|
|
'''
|
|
print(subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',code],text=True))
|
|
r=subprocess.run(['docker','logs','--tail','50','huobao-comfy-gpu1'],capture_output=True,text=True)
|
|
lines=(r.stdout+r.stderr).replace('\r','\n').splitlines()
|
|
for line in lines:
|
|
if any(x in line for x in ('%|','Prompt executed','Error','OutOfMemory','Loading','loaded completely')):print(line[:240])
|