ashb commented on a change in pull request #18503:
URL: https://github.com/apache/airflow/pull/18503#discussion_r716193475
##########
File path: airflow/models/dagrun.py
##########
@@ -381,11 +382,14 @@ def get_task_instance(self, task_id: str, session:
Session = None) -> Optional[T
:param session: Sqlalchemy ORM Session
:type session: Session
"""
- return (
+ ti = (
session.query(TI)
.filter(TI.dag_id == self.dag_id, TI.run_id == self.run_id,
TI.task_id == task_id)
.one_or_none()
)
+ if ti:
+ set_committed_value(ti, 'dag_run', self)
+ return ti
Review comment:
It can - the difference here is the extra join - that would result in a
more complex query, and _we know_ that the ti belongs to those dag run.
--
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]