dstandish commented on code in PR #32646:
URL: https://github.com/apache/airflow/pull/32646#discussion_r1393418115


##########
airflow/models/taskinstance.py:
##########
@@ -895,6 +895,19 @@ def refresh_from_db(self, session: Session = NEW_SESSION, 
lock_for_update: bool
         else:
             self.state = None
 
+    @classmethod
+    def get_by_key(cls, ti_key, session) -> TaskInstance:
+        return (
+            session.query(TaskInstance)
+            .filter(
+                TaskInstance.task_id == ti_key.task_id,
+                TaskInstance.dag_id == ti_key.dag_id,
+                TaskInstance.run_id == ti_key.run_id,
+                TaskInstance.map_index == ti_key.map_index,
+            )
+            .one_or_none()
+        )

Review Comment:
   don't need to reuse, but sticking it in (private) free function just for 
readability



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to