Hi is there a way to clear work queues? I can see a method to delete but not to clear. Have had instance where a agents polling the queue were down for quite a while and runs built up. I would like to be able to clear any delayed runs rather than having them all play through.
a
Aaron
11/11/2022, 5:42 PM
I don't believe so. Apparently it was a feature in Prefect 1, has not been added to 2 yet. I've had the same issue where a long running flow run queued up dozens of late ones
d
Dan Wise
11/11/2022, 6:47 PM
Hey thanks Aaron. I’m finding a lot of features which were useful in v1 which have been dropped.
a
Aaron
11/11/2022, 6:49 PM
My workaround has been to use separate work queues. I have a flow that runs every few minutes, and issues with other flows could cause a bunch of those to get queued up with "Late" status, and then all of those Late runs would still run once the stalled flow finished.
n
Nate
11/11/2022, 8:59 PM
I agree it'd be nice to have a first class way of doing this, but for the time being you can always do something like
Copy code
from prefect.client import get_client()
async with get_client() as client:
try:
runs = await client.get_runs_in_work_queue("<MY-QUEUE-UUID>")
for run in runs:
await client.delete_flow_run(flow_run_id=run.id)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.