'Deactivate any DAGs that were last touched by the scheduler before
the expiration date. These DAGs were likely deleted.
:param expiration_date: set inactive DAGs that were touched before this
time
:type expiration_date: datetime
:return: None'

@staticmethod
@provide_session
def deactivate_stale_dags(expiration_date, session=None):

    for dag in session.query(DagModel).filter((DagModel.last_scheduler_run < expiration_date), DagModel.is_active).all():
        logging.info(u'Deactivating    DAG    ID    %s    since    it    was    last    touched    by    the    scheduler    at    %s', dag.dag_id, dag.last_scheduler_run.isoformat())
        dag.is_active = False
        session.merge(dag)
        session.commit()
