Files
dj/integration-work/inspect_8189_integration.py

34 lines
1.8 KiB
Python

import subprocess,json,pathlib
def run(*a):return subprocess.check_output(a,text=True)
for name in ('comfyui-manju',):
code="""import pathlib,json,urllib.request
p=pathlib.Path('/app/server.py'); s=p.read_text();print('scoped_cancel_api', '/api/jobs/{job_id}/cancel' in s)
with urllib.request.urlopen('http://127.0.0.1:8188/queue') as r:q=json.load(r)
print('queue', {k:[x[1] for x in q.get(k,[])] for k in ('queue_running','queue_pending')})
with urllib.request.urlopen('http://127.0.0.1:8188/history') as r:h=json.load(r)
print('history_count',len(h))
p=pathlib.Path('/recovery/allowed_node_classes.json');print('allowlist_count',len(json.loads(p.read_text())['required_classes']) if p.exists() else 0)
"""
print(name,run('docker','exec',name,'python','-c',code))
code="""import app,inspect
for name in ('submit_job','create_job','provider_queue_depth','job_state'):
f=getattr(app,name,None)
if f:print(inspect.getsource(f))
"""
path=pathlib.Path('/home/ps/huobao-gpu-selection/normalizer-current-read.txt')
path.write_text(run('docker','exec','huobao-vdn-normalizer','python','-c',code))
print('normalizer functions saved',path)
code="""import app,asyncio,httpx,json
async def main():
async with httpx.AsyncClient(timeout=10) as c:
for p in app.providers().values():
q=(await c.get(p.base_url+'/queue',headers=app.provider_headers(p))).json()
print(json.dumps({'id':p.id,'queue':{k:[x[1] for x in q.get(k,[])] for k in ('queue_running','queue_pending')}}))
asyncio.run(main())
"""
print(run('docker','exec','huobao-vdn-normalizer','python','-c',code))
# Verify GPU3 panel upstream identity without printing credentials.
p=pathlib.Path('/home/www/open-ai-canvas/.releases/h3-gpu3-panel-8191-20261014-8a5f/nginx.conf')
for line in p.read_text().splitlines():
if 'set $gpu3' in line:print(line)