Cris
06/12/2020, 8:33 PMalex
06/12/2020, 8:51 PMalex
06/12/2020, 8:52 PMalex
06/12/2020, 8:53 PMCris
06/12/2020, 8:59 PMCris
06/12/2020, 9:00 PMalex
06/12/2020, 9:08 PMDagsterInstance.get().delete_run(run_id)
alex
06/12/2020, 9:12 PMalex
06/12/2020, 9:20 PMfrom dagster import DagsterInstance
def clean_old_runs():
# get access to instance DBs - assumes locally configred with
# $DAGSTER_HOME/dagster.yaml
instance = DagsterInstance.get()
runs = instance.get_runs() # can take limit & cursor if you want to go in batches
for pipeline_run in runs:
stats = instance.get_run_stats(pipeline_run.run_id)
stats.end_time # unix time stamp
# do your date math
if too_old:
instance.delete_run(pipeline_run.run_id)
alex
06/12/2020, 9:20 PMCris
06/12/2020, 10:08 PMCris
06/12/2020, 11:38 PMalex
06/13/2020, 1:44 AM