Skip to content

BranchSQLOperator not skipping downstream BranchSQLOperator #53444

@AZSJTinus

Description

@AZSJTinus

Apache Airflow version

3.0.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

The BranchSQLOperator did not skip a downstream BranchSQLOperator.
This was working until the 3.0.3 update, eg 3.0.2 seems to have been working fine.

The skipping list is empty:

Image

What you think should happen instead?

This issue seems very similar to #52219, a similar change also fixed my issue however, I needed to add the code below to _ensure_tasks:

    from airflow.providers.common.sql.operators.sql import BaseSQLOperator

    return [n for n in nodes if isinstance(n, (BaseOperator, MappedOperator, BaseSQLOperator))]

Afterwards the skipping list contains the BranchSQLOperator:

Image

How to reproduce

Create a DAG with a BranchSQLOperator that also has a downstream BranchSQLOperator.
When running observe that the downstream BranchSQLOperator is not skipped even when it needed to be.

Operating System

Ubuntu 22.04.5 LTS

Versions of Apache Airflow Providers

apache_airflow_providers_common_sql-1.27.3
apache_airflow_providers_microsoft_mssql-4.3.1
apache_airflow_providers_standard-1.4.0
apache_airflow_task_sdk-1.0.3

Deployment

Virtualenv installation

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions