tanelk opened a new issue #22078:
URL: https://github.com/apache/airflow/issues/22078


   ### Apache Airflow version
   
   main (development)
   
   ### What happened
   
   `ExternalTaskSensorLink` points to a DAG run with `execution_date` same as 
the `ExternalTaskSensor`.
   
   ### What you expected to happen
   
   `ExternalTaskSensorLink` should point to the actual DAG run it is waiting on.
   
   ### How to reproduce
   
   For example with by modifing this UT:
   ```diff --git a/tests/sensors/test_external_task_sensor.py 
b/tests/sensors/test_external_task_sensor.py
   index 6e7222ed4..9aa941f9e 100644
   --- a/tests/sensors/test_external_task_sensor.py
   +++ b/tests/sensors/test_external_task_sensor.py
   @@ -413,6 +413,7 @@ def test_external_task_sensor_templated(dag_maker, app):
                task_id='templated_task',
                external_dag_id='dag_{{ ds }}',
                external_task_id='task_{{ ds }}',
   +            execution_delta=timedelta(days=1)
            )
   
        dagrun = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED, 
execution_date=DEFAULT_DATE)
   @@ -427,7 +428,7 @@ def test_external_task_sensor_templated(dag_maker, app):
        with app.app_context():
            url = instance.task.get_extra_links(instance, "External DAG")
   
   -        assert f"tree?dag_id=dag_{DEFAULT_DATE.date()}" in url
   +        assert 
f"tree?dag_id=dag_{DEFAULT_DATE.date()}&execution_date={(DEFAULT_DATE - 
timedelta(days=1)).date()}" in url
   ```
   
   Curreantly it fails with `E           AssertionError: assert 
'tree?dag_id=dag_2015-01-01&execution_date=2014-12-31' in 
'http:///tree?dag_id=dag_2015-01-01&execution_date=2015-01-01T00%3A00%3A00%2B00%3A00'`,
 but should succeed
   
   ### Operating System
   
   Arch Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   Should modify the `ExternalTaskSensorLink.get_link` method.
   The `operator` in there is a `SerializedBaseOperator` and I did not figure 
out how to access the `execution_delta` and `execution_date_fn` fields from 
there.
   
   ### 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