Files
dj/integration-work/cancel_alignment_queue.py
T

15 lines
797 B
Python

import subprocess
code='''import asyncio,httpx,json,app
async def main():
p=app.providers()['default'];jid='1c6f7d58-5f0a-4f4d-997e-a844d8b0d507'
async with httpx.AsyncClient(timeout=20) as c:
q=(await c.get(p.base_url+'/queue',headers=app.provider_headers(p))).json()
assert not any(x[1]==jid for x in q.get('queue_running',[])), 'Do not interrupt running worker'
if any(x[1]==jid for x in q.get('queue_pending',[])):
r=await c.post(p.base_url+'/queue',headers=app.provider_headers(p),json={'delete':[jid]});r.raise_for_status()
print('Removed only isolated alignment-test job from pending queue')
else: print('Isolated alignment-test job not pending')
asyncio.run(main())
'''
print(subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',code],text=True))