uranusjr commented on a change in pull request #22491:
URL: https://github.com/apache/airflow/pull/22491#discussion_r834174737
##########
File path: airflow/ti_deps/deps/prev_dagrun_dep.py
##########
@@ -66,6 +67,23 @@ def _get_dep_statuses(self, ti, session, dep_context):
previous_ti = last_dagrun.get_task_instance(ti.task_id,
session=session)
if not previous_ti:
+ if ti.task.ignore_first_depends_on_past:
+ historical_ti = (
+ session.query(TI)
+ .filter(
+ TI.dag_id == ti.dag_id,
+ TI.task_id == ti.task_id,
+ TI.execution_date < ti.execution_date,
+ )
+ .first()
+ )
Review comment:
Alternatively we could do
`session.query(func.count()).filter(...).scalar() > 0`, which is probably
slower, but still reasonable since the filtered columns are indexed, and
arguably most readable?
--
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]