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/08/02 17:49:38 UTC

[GitHub] [airflow] potiuk commented on a diff in pull request #24931: Apply flake8-logging-format changes to tests

potiuk commented on code in PR #24931:
URL: https://github.com/apache/airflow/pull/24931#discussion_r935868845


##########
tests/providers/google/cloud/utils/gcp_authenticator.py:
##########
@@ -107,8 +107,8 @@ def set_key_path_in_airflow_connection(self):
             extras[PROJECT_EXTRA] = self.project_extra if self.project_extra else self.project_id
             conn.extra = json.dumps(extras)
             session.commit()
-        except BaseException as ex:
-            self.log.error('Airflow DB Session error: %s', str(ex))
+        except BaseException:
+            self.log.error('Airflow DB Session error.')

Review Comment:
   This log really adds no value here.
   
   After looking at at that - It should be REALLY ok to just remove the except clause altogether. It's not needed here at all. 
   
   
   The session.close() method in finally will automatically rollback the transaction, there is no need to do it manually in "except" clausehttps://docs.sqlalchemy.org/en/14/orm/session_basics.html#closing:
   
   > The close() method issues a expunge_all(), and [releases](http://docs.sqlalchemy.org/en/latest/glossary.html#term-releases) any transactional/connection resources. When connections are returned to the connection pool, transactional state is rolled back as well.



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