code: def reset_dag(dag, session):
      """
      Delete all dag and task instances and then un_pause the Dag.
      """
      import airflow.models
  
      DR = airflow.models.DagRun
      DM = airflow.models.DagModel
      TI = airflow.models.TaskInstance
      TF = airflow.models.TaskFail
      dag_id = dag.dag_id
  
      session.query(DM).filter(DM.dag_id == dag_id).update(
          {"is_paused": False}
      )
      session.query(DR).filter(DR.dag_id == dag_id).delete()
      session.query(TI).filter(TI.dag_id == dag_id).delete()
      session.query(TF).filter(TF.dag_id == dag_id).delete()
  
file_path: airflow/dev/perf/scheduler_dag_execution_timing.py
imports: from __future__ import annotations
  import gc
  import os
  import statistics
  import sys
  import textwrap
  import time
  from argparse import Namespace
  from operator import attrgetter
  import rich_click
  from airflow.jobs.job import run_job
label_desc: Use image node_id 2 for calling a global function with example usage: reset_dag(dag, session) without return types