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


##########
airflow/models/dagrun.py:
##########
@@ -501,11 +523,36 @@ def get_task_instance(
         """
         Return the task instance specified by task_id for this dag run.
 
+        :param task_id: the task id
+        :param session: Sqlalchemy ORM Session
+        """
+        return DagRun.fetch_task_instance(
+            dag_run=self,
+            task_id=task_id,
+            session=session,
+            map_index=map_index,
+        )
+
+    @staticmethod
+    @internal_api_call
+    @provide_session
+    def fetch_task_instance(
+        dag_run: DagRun | DagRunPydantic,

Review Comment:
   Same here.. We should really pass `dag_run_id: str` here and retrieve DagRun 
from the session . There is absolutely no need to pass `dag_run` object here. 
   
   First line of the method should be
   ```
   dag_run = session.get(DagRun, dag_run_id)
   ```
   
   



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