armandduijn opened a new issue, #40745:
URL: https://github.com/apache/airflow/issues/40745

   ### Apache Airflow version
   
   2.9.2
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   The ExternalTaskSensor in deferrable mode doesn't throw an error if the 
external DAG doesn't exist. Setting `check_existence=True` doesn't have an 
effect.
   
   ### What you think should happen instead?
   
   The task should immediately fail instead of staying in the deferred state.
   
   ### How to reproduce
   
   The code below implements a DAG with two ExternalTaskSensor tasks. One task 
is set to be deferred and the other one is old non-deferred way.
   
   When running the DAG, the `regular_sensor` task will immediately retry and 
eventually fail, while the `defer_sensor` task will remain deferred.
   
   ```python
   from datetime import datetime
   
   from airflow import DAG
   from airflow.sensors.external_task import ExternalTaskSensor
   
   with DAG(
       "Test",
       default_args={ "start_date": datetime(2024, 7, 11) }
   ) as dag:
       ExternalTaskSensor(
           task_id="defer_sensor",
           external_dag_id="FakeDAG",
           check_existence=True,
           deferrable=True,
       )
   
       ExternalTaskSensor(
           task_id="regular_sensor",
           external_dag_id="FakeDAG",
           check_existence=True,
           deferrable=False,
       )
   ```
   
   ### Operating System
   
   Windows
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _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