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


##########
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:
   You can instead re-try the transaction 
https://github.com/apache/airflow/blob/23264fb820c179e9951ea9706f68b13a9b3fdbc0/airflow/utils/retries.py#L49



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to