Hello everybody! I’m new at dagster. My sensor qu...
# ask-community
v
Hello everybody! I’m new at dagster. My sensor queued too much runs (8475). How to delete from query all runs?
c
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
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
Oh, thank you! I’ve already solved my problem. But it's really good advice!
😄 1