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/07/28 16:47:24 UTC

[GitHub] [airflow] jedcunningham commented on a diff in pull request #25312: Don't mistakenly take a lock on DagRun via ti.refresh_from_fb

jedcunningham commented on code in PR #25312:
URL: https://github.com/apache/airflow/pull/25312#discussion_r932466512


##########
airflow/models/taskinstance.py:
##########
@@ -848,28 +849,35 @@ def refresh_from_db(self, session: Session = NEW_SESSION, lock_for_update: bool
         """
         self.log.debug("Refreshing TaskInstance %s from DB", self)
 
-        qry = session.query(TaskInstance).filter(
-            TaskInstance.dag_id == self.dag_id,
-            TaskInstance.task_id == self.task_id,
-            TaskInstance.run_id == self.run_id,
-            TaskInstance.map_index == self.map_index,
+        if self in session:
+            session.refresh(self, TaskInstance.__mapper__.column_attrs.keys())
+
+        qry = (
+            # To avoid joining any relationships by default select the all

Review Comment:
   ```suggestion
               # To avoid joining any relationships, by default select all
   ```
   
   nit, took me a couple readings to sort this out



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