ashb commented on a change in pull request #16086:
URL: https://github.com/apache/airflow/pull/16086#discussion_r639999414
##########
File path: airflow/models/dag.py
##########
@@ -1025,11 +1025,70 @@ def get_task_instances(self, start_date=None,
end_date=None, state=None, session
start_date = (timezone.utcnow() - timedelta(30)).date()
start_date = timezone.make_aware(datetime.combine(start_date,
datetime.min.time()))
- tis = session.query(TaskInstance).filter(
- TaskInstance.dag_id == self.dag_id,
- TaskInstance.execution_date >= start_date,
- TaskInstance.task_id.in_([t.task_id for t in self.tasks]),
+ return (
+ self._get_task_instances(
+ task_ids=None,
+ start_date=start_date,
+ end_date=end_date,
+ state=state,
+ include_subdags=False,
+ include_parentdag=False,
+ include_dependent_dags=False,
+ as_pk_tuple=False,
+ session=session,
+ )
+ .order_by(TaskInstance.execution_date)
+ .all()
)
+
+ def _get_task_instances(
+ self,
+ *,
+ task_ids,
Review comment:
It's internal, so I went with explicit rather than implicit.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]