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/06/09 03:06:05 UTC
[GitHub] [airflow] uranusjr commented on issue #24339: airflow db cleanup - psycopg2.errors.InFailedSqlTransaction celery_taskmeta
uranusjr commented on issue #24339:
URL: https://github.com/apache/airflow/issues/24339#issuecomment-1150618252
I think we need to check [`session.is_active`](https://docs.sqlalchemy.org/en/14/orm/session_api.html#sqlalchemy.orm.Session.is_active), but otherwise the fix makes sense.
Actually, the context manager can be simplified to
```python
@contextlib.contextmanager
def _warn_if_missing(table, session):
try:
yield
except (OperationalError, ProgrammingError):
logger.warning("Table %r not found. Skipping.", table)
if session.is_active:
session.rollback()
raise
```
--
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