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/21 23:00:00 UTC
[GitHub] [airflow] kaxil commented on a diff in pull request #28481: dagwarning, add error handling to purge_inactive_dag_warnings
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org