class_docstr: Serializable representation of the DagRun ORM SqlAlchemyModel used by internal API.
class_docstr_tok: ["Serializable","representation","of","the","DagRun","ORM","SqlAlchemyModel","used","by","internal","API","."]
docstr: Return the task instance specified by task_id for this dag run.
  
  :param task_id: the task id
  :param session: Sqlalchemy ORM Session
docstr_tok: ["Return","the","task","instance","specified","by","task_id","for","this","dag","run",".",":","param","task_id",":","the","task","id",":","param","session",":","Sqlalchemy","ORM","Session"]
code: def get_task_instance(
      self,
      task_id: str,
      session: Session = NEW_SESSION,
      *,
      map_index: int = -1,
  ) -> TI | TaskInstancePydantic | None:
      """
      Return the task instance specified by task_id for this dag run.
  
      :param task_id: the task id
      :param session: Sqlalchemy ORM Session
      """
      from airflow.models.dagrun import DagRun
  
      return DagRun.fetch_task_instance(
          dag_id=self.dag_id,
          dag_run_id=self.run_id,
          task_id=task_id,
          session=session,
          map_index=map_index,
      )
  
file_path: airflow/airflow/serialization/pydantic/dag_run.py
imports: from __future__ import annotations
  from datetime import datetime
  from typing import TYPE_CHECKING, Iterable, List, Optional
  from pydantic import BaseModel, ConfigDict
  from airflow.serialization.pydantic.dag import PydanticDag
  from airflow.serialization.pydantic.dataset import DatasetEventPydantic
  from airflow.utils.session import NEW_SESSION, provide_session
label_desc: Use image node_id 3 for calling the DagRunPydantic obj's underlying member method code with example usage: obj.get_task_instance(task_id, session) and returns: DagRun