https://dagster.io/ logo
#ask-community
Title
# ask-community
v

Valentine Kim

08/24/2022, 12:08 PM
Hello everybody! I’m new at dagster. My sensor queued too much runs (8475). How to delete from query all runs?
c

chris

08/25/2022, 12:07 AM
Hey Valentine - there's no super easy way to do this right now - https://github.com/dagster-io/dagster/issues/8010 , but what you can do is use the DagsterInstance to delete all runs in the queued state. You would run a python script that initializes your DagsterInstance, retrieve all run_ids for queued runs, and then call `delete_run`:
Copy code
from dagster import DagsterInstance, DagsterRunStatus

instance = DagsterInstance.get()
for run in instance.get_runs():
     if run.status == DagsterRunStatus.QUEUED:
         instance.delete_run(run.run_id)
r

Roel Hogervorst

09/01/2022, 2:41 PM
A hacky way I used is to log into the database and do a simple delete from runs where type = 'QUEUED' (or something, I don't have the exact command close by)
I feel is probably a graphql query where you select all the queud runs and delete those
v

Valentine Kim

09/01/2022, 2:52 PM
Oh, thank you! I’ve already solved my problem. But it's really good advice!
😄 1
4 Views