uranusjr commented on a change in pull request #22491:
URL: https://github.com/apache/airflow/pull/22491#discussion_r834173046



##########
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:
       ```suggestion
                   historical_ti = (
                       session.query(literal(True))
                       .filter(
                           TI.dag_id == ti.dag_id,
                           TI.task_id == ti.task_id,
                           TI.execution_date < ti.execution_date,
                       )
                       .first()
                   )
   ```
   
   This would save some deserialisation effort since we don’t actually care 
about the selected task instance, but only whether it exists.




-- 
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]


Reply via email to