villasv commented on a change in pull request #5883: [AIRFLOW-5194] Add error
handler to action log
URL: https://github.com/apache/airflow/pull/5883#discussion_r316793212
##########
File path: airflow/utils/cli_action_loggers.py
##########
@@ -94,8 +94,11 @@ def default_action_log(log, **_):
:param **_: other keyword arguments that is not being used by this function
:return: None
"""
- with create_session() as session:
- session.add(log)
+ try:
+ with create_session() as session:
+ session.add(log)
+ except Exception as error:
Review comment:
It is, though I don't think it's worth it. An SQLAchemy exception is
basically the only thing that could pop out of that `session.add`, and
filtering by error message doesn't seem relevant to me.
Also, logging CLI actions is non-critical. If it fails for any other reason
than "table log doesn't exist" like failing to connect to the database or
SQLAlchemy is badly installed or whatever, we mostly don't care.
The only thing that this PR changes is that instead of a huge wall of red
text we get a few lines of blue text in the terminal when `session.add(log)`
fails. As it was before, it wasn't stopping the CLI action to move forward.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services