farrukh-t opened a new issue, #66695:
URL: https://github.com/apache/airflow/issues/66695

   ### Under which category would you file this issue?
   
   Providers
   
   ### Apache Airflow version
   
   3.2.1
   
   ### What happened and how to reproduce it?
   
   The `External DAG` button that appears in Airflow UI under `Details` tab 
when selecting an `ExternalTaskSensor` task targets an incorrect logical date 
for the upstream DAG. It appears that the button targets a logical date of the 
DAG where the ExternalTaskSensor is created rather than the External (upstream) 
DAG.
   
   Here is an example to reproduce - suppose you have 2 DAGs, `upstream` and 
`downstream`:
   
   `upstream.py`:
   ```py
   from datetime import datetime
   
   from airflow.providers.standard.operators.empty import EmptyOperator
   from airflow.sdk import DAG
   
   with DAG(
       dag_id="upstream",
       default_args={
           "depends_on_past": False,
           "retries": 0,
       },
       schedule="0 2 * * *",
       catchup=False,
       start_date=datetime(2026, 5, 1),
   ) as dag:
       start = EmptyOperator(task_id="start")
       finish = EmptyOperator(task_id="finish")
   
       start >> finish
   
   ```
   
   `downstream.py`:
   ```py
   from datetime import datetime, timedelta
   
   from airflow.providers.standard.operators.empty import EmptyOperator
   from airflow.providers.standard.sensors.external_task import 
ExternalTaskSensor
   from airflow.sdk import DAG
   
   with DAG(
       dag_id="downstream",
       default_args={
           "depends_on_past": False,
           "retries": 0,
       },
       schedule="0 4 * * *",
       catchup=False,
       start_date=datetime(2026, 5, 1),
   ) as dag:
       wait_for_upstream = ExternalTaskSensor(
           task_id="wait_for_upstream",
           external_dag_id="upstream",
           external_task_id="finish",
           execution_delta=timedelta(hours=2),
           poke_interval=60,
           timeout=60 * 60,
           mode="reschedule",
       )
   
       process = EmptyOperator(task_id="process")
       finish = EmptyOperator(task_id="finish")
   
       wait_for_upstream >> process >> finish
   ```
   
   Note the difference in the DAGs' schedules - `upstream` runs daily at 2 AM, 
`downstream` - daily at 4 AM. The downstream DAG has an `ExternalTaskSensor` 
task that waits for the `upstream` DAG.
   
   The issue is that if you click the `External DAG` button on the 
`ExternalTaskSensor` task - it redirects you to a DAG run that doesn't exist - 
the time in the link is `04:00:00+00:00`, but it should be `02:00:00+00:00`:
   
   <img width="1915" height="1019" alt="Image" 
src="https://github.com/user-attachments/assets/a3416f37-ed8c-488f-bef8-25d62b6cb7ee";
 />
   
   <img width="1915" height="1019" alt="Image" 
src="https://github.com/user-attachments/assets/3991c5ea-2800-464b-b2d9-f2071c73c3cb";
 />
   
   <img width="1915" height="1019" alt="Image" 
src="https://github.com/user-attachments/assets/ee335ee6-7482-487e-b68a-bae09417e356";
 />
   
   ### What you think should happen instead?
   
   The `External DAG` button should point to the run ID of the upstream 
(target) DAG, not its own run ID.
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Apache Airflow Provider(s)
   
   standard
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-standard         1.12.3
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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