Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions airflow/utils/cli_action_loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def default_action_log(sub_command, user, task_id, dag_id, execution_date, host_
:param **_: other keyword arguments that is not being used by this function
:return: None
"""
from sqlalchemy.exc import OperationalError, ProgrammingError

from airflow.models.log import Log
from airflow.utils import timezone
from airflow.utils.session import create_session
Expand All @@ -121,8 +123,18 @@ def default_action_log(sub_command, user, task_id, dag_id, execution_date, host_
}
],
)
except Exception as error:
logging.warning("Failed to log action with %s", error)
except (OperationalError, ProgrammingError) as e:
expected = [
'"log" does not exist', # postgres
"no such table", # sqlite
"log' doesn't exist", # mysql
"Invalid object name 'log'", # mssql
]
error_is_ok = e.args and any(x in e.args[0] for x in expected)
if not error_is_ok:
logging.warning("Failed to log action %s", e)
except Exception as e:
logging.warning("Failed to log action %s", e)


__pre_exec_callbacks: list[Callable] = []
Expand Down