Jarvis Stubblefield
06/12/2023, 11:01 PMJarvis Stubblefield
06/12/2023, 11:19 PMJarvis Stubblefield
06/12/2023, 11:22 PMprefect flow-run ls | awk 'NR>3 {print $2}' | while read line
do
prefect flow-run delete $line
done
I have figured out that “lot” means more than “tens” of flow runs… I have thousands of flow runs that need to be removed to clean up this mess.Jake Kaplan
06/13/2023, 1:03 AMread_flow_runs
this will delete runs indiscriminately
import asyncio
from prefect.client.orchestration import get_client
async def delete_flow_runs():
async with get_client() as client:
while True:
flow_runs = await client.read_flow_runs(limit=50)
if len(flow_runs) == 0:
break
await asyncio.gather(*[client.delete_flow_run(fr.id) for fr in flow_runs])
if __name__ == '__main__':
asyncio.run(delete_flow_runs())
Jake Kaplan
06/13/2023, 1:04 AMJarvis Stubblefield
06/13/2023, 1:04 AMJake Kaplan
06/13/2023, 1:04 AMJarvis Stubblefield
06/13/2023, 1:12 AMJake Kaplan
06/13/2023, 1:18 AMJarvis Stubblefield
06/13/2023, 1:29 AM