This is an automated email from the ASF dual-hosted git repository.
potiuk 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 20fb83c2dd1 Fix ExternalTaskSensor example Dag never finding its
parent task (#72480)
20fb83c2dd1 is described below
commit 20fb83c2dd1435fb87b2a9826614b476bba68a9a
Author: Dheeren Mohta <[email protected]>
AuthorDate: Wed Sep 9 04:02:20 2026 +0530
Fix ExternalTaskSensor example Dag never finding its parent task (#72480)
Both example Dags in example_external_task_marker_dag.py used
schedule=None, so every run was independently, manually triggered and
got its own logical date. ExternalTaskSensor matches task instances by
logical date by default, so the child's sensor could never find a
matching task instance in the parent Dag, making the example unusable
as a template for a working ExternalTaskSensor + ExternalTaskMarker
setup.
Give both Dags the same recurring schedule so that corresponding
parent/child Dag runs share a logical date, as originally diagnosed by
a maintainer on the issue.
Closes: #13681
---
.../standard/example_dags/example_external_task_marker_dag.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git
a/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py
b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py
index 50ab3e806cf..af39730e398 100644
---
a/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py
+++
b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py
@@ -36,10 +36,17 @@ with multiple downstream tasks
ExternalTaskSensor times out. In this case, ExternalTaskSensor will raise
AirflowSkipException
or AirflowSensorTimeout exception
+Both Dags must share the same schedule (and must not use ``schedule=None``) so
that a parent
+Dag run and its corresponding child Dag run share the same logical date.
ExternalTaskSensor
+matches task instances by logical date by default, so unrelated logical dates
(e.g. from two
+independently, manually triggered runs) will never be found.
+
"""
from __future__ import annotations
+from datetime import timedelta
+
import pendulum
from airflow.providers.standard.operators.empty import EmptyOperator
@@ -52,7 +59,7 @@ with DAG(
dag_id="example_external_task_marker_parent",
start_date=start_date,
catchup=False,
- schedule=None,
+ schedule=timedelta(minutes=30),
tags=["example", "example2"],
) as parent_dag:
# [START howto_operator_external_task_marker]
@@ -66,7 +73,7 @@ with DAG(
with DAG(
dag_id="example_external_task_marker_child",
start_date=start_date,
- schedule=None,
+ schedule=timedelta(minutes=30),
catchup=False,
tags=["example", "example2"],
) as child_dag: