11 lines
575 B
Python
11 lines
575 B
Python
import subprocess
|
|
code='''import asyncio,httpx,json,app
|
|
async def main():
|
|
async with httpx.AsyncClient(timeout=20) as c:
|
|
for p in app.providers().values():
|
|
q=(await c.get(p.base_url+'/queue',headers=app.provider_headers(p))).json()
|
|
print(p.id,json.dumps({k:[{'id':x[1],'nodes':sorted({n['class_type'] for n in x[2].values() if isinstance(n,dict) and 'class_type' in n})} for x in q.get(k,[])] for k in ('queue_running','queue_pending')}))
|
|
asyncio.run(main())
|
|
'''
|
|
print(subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',code],text=True))
|