Bulk run DAGs from Airflow without the API

  • You can create a DAG that gets a list of DAGs (based on tag or name) and loops through them to trigger one by one.
  • You can create a DAG to unpause the DAGs and if startdate is 1 day ago. It will automatically trigger DAGs which are unpaused .
def unpause_all_dags():
    with create_session() as session:
        try:
            # Use SQLAlchemy's update function with a subquery to unpause DAGs matching the regex pattern
            subquery = text(
                "UPDATE dag " "SET is_paused = :unpaused " "WHERE dag_id LIKE :pattern"
            )
            session.execute(subquery, {"unpaused": False, "pattern": "scenario%case%"})
            session.commit()
        except Exception as e:
            session.rollback()
            raise e

Thanks
Manmeet