Skip to content

Deferrable ExternalTaskSensor cannot wait for an entire DAG #34207

@ecodina

Description

@ecodina

Apache Airflow version

2.7.1

What happened

When running an ExternalTaskSensor with external_task_id=None and in deferrable mode, the trigger doesn't wait for the entire DAG since it needs a task_id. However, the typing suggests this should be possible: https://github.com/apache/airflow/blob/main/airflow/triggers/external_task.py#L63

I believe this is the query that doesn't behave as expected from the typing: https://github.com/apache/airflow/blob/main/airflow/triggers/external_task.py#L135

Moreover, after examining the code, it seems the trigger would also fail if the ExternalTaskSensor was provided with an external_task_ids (multiple tasks).

What you think should happen instead

No response

How to reproduce

  1. Create dag1 which contains a simple task (e.g. sleep for 60 seconds)
  2. Create dag2 which contains an ExternalTaskSensor checking for dag1 (external_task_id=None) and runs in deferrable mode
  3. Run them and see how dag2 times out because it can't find any task.

Operating System

Ubuntu 22.04.3 LTS

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else

Similarly to #34204 I'd love to submit a PR, but have no available time to properly do so or the knowledge to make sure any of my solutions actually work in all cases.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions