You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/22 21:02:57 UTC

[GitHub] [airflow] michaelmicheal commented on a diff in pull request #28481: dagwarning, add error handling to purge_inactive_dag_warnings

michaelmicheal commented on code in PR #28481:
URL: https://github.com/apache/airflow/pull/28481#discussion_r1055846581


##########
airflow/models/dagwarning.py:
##########
@@ -79,7 +83,12 @@ def purge_inactive_dag_warnings(cls, session: Session = NEW_SESSION) -> None:
             query = session.query(cls).filter(cls.dag_id.in_(dag_ids))
         else:
             query = session.query(cls).filter(cls.dag_id == DagModel.dag_id, DagModel.is_active == false())
-        query.delete(synchronize_session=False)
+        try:
+            query.delete(synchronize_session=False)
+        except OperationalError:
+            # If the purge query fails, it's not critical to the dag processor
+            # We ignore it so the dag processor manager doesn't exit
+            log.error("Failed to purge inactive dag_warnings, ignoring")

Review Comment:
   What do you think of this? Also, do you think we need to run this query every parsing loop? What if we only run it every x seconds and make that configurable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org