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/11/23 04:35:13 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #27851: Don't log CLI actions if db not initialized

uranusjr commented on code in PR #27851:
URL: https://github.com/apache/airflow/pull/27851#discussion_r1030013587


##########
airflow/utils/cli_action_loggers.py:
##########
@@ -121,8 +123,17 @@ 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
+        ]
+        if getattr(e, "args", None) and not any(x in e.args[0] for x in expected):

Review Comment:
   I don’t think `e.args` can ever be missing (it’s guaranteed by Python)



-- 
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