I was wondering if anyone could share with me a sc...
# ask-community
m
I was wondering if anyone could share with me a script or documentation on how to clean up the Prefect filesystem after deleting old flow_runs, task_runs and artifacts in the database?
b
Hi Maity, thanks for your message. There was another community member that asked a similar question here. TLDR; you can leverage the python API to do this.
m
Thanks @Bianca Hoch! Fantastic, but I did check out the code for the Prefect API endpoint before I asked this question and didn't see where it removed the related files from the filesystem. It simply did a sqlalchemy delete command to the database, which would leave the loose pickled files (task cache, flow cache, result_in_memory=False) to forever build up. Am I correct in thinking this?