This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 42e73140b53 fix mypy type errors in prev_dagrun_dep.py (#57119)
42e73140b53 is described below
commit 42e73140b53099e7d7eefa48e9b4c17651826279
Author: arkadiuszbach <[email protected]>
AuthorDate: Thu Oct 23 16:18:34 2025 +0200
fix mypy type errors in prev_dagrun_dep.py (#57119)
---
airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep.py
b/airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep.py
index 71a6f583f29..46271baa42e 100644
--- a/airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep.py
+++ b/airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep.py
@@ -98,7 +98,7 @@ class PrevDagrunDep(BaseTIDep):
This function exists for easy mocking in tests.
"""
- return session.scalar(
+ unsuccessful_tis_count = session.scalar(
select(func.count()).where(
TI.dag_id == dagrun.dag_id,
TI.task_id == task_id,
@@ -106,6 +106,7 @@ class PrevDagrunDep(BaseTIDep):
or_(TI.state.is_(None), TI.state.not_in(_SUCCESSFUL_STATES)),
)
)
+ return 0 if unsuccessful_tis_count is None else unsuccessful_tis_count
@staticmethod
def _has_unsuccessful_dependants(
@@ -178,7 +179,12 @@ class PrevDagrunDep(BaseTIDep):
return
# There was a DAG run, but the task wasn't active back then.
- if catchup and last_dagrun.logical_date < ti.task.start_date:
+ if (
+ catchup
+ and ti.task.start_date is not None
+ and last_dagrun.logical_date is not None
+ and last_dagrun.logical_date < ti.task.start_date
+ ):
self._push_past_deps_met_xcom_if_needed(ti, dep_context)
yield self._passing_status(reason="This task instance was the
first task instance for its task.")
return