@provide_session<EOL><INDENT>def get_task_instance(self, task_id, session=None):<DEDENT>
from airflow.models.taskinstance import TaskInstance  <EOL>TI = TaskInstance<EOL>ti = session.query(TI).filter(<EOL>TI.dag_id == self.dag_id,<EOL>TI.execution_date == self.execution_date,<EOL>TI.task_id == task_id<EOL>).first()<EOL>return ti<EOL>
Returns the task instance specified by task_id for this dag run

:param task_id: the task id