Skip to content

Branching is broken when callable function returns None or falsy value #54340

@yershovkiril

Description

@yershovkiril

Apache Airflow version

3.0.4

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

No response

What happened?

Previously (before 3.0.4) when BranchPythonOperator callable returned None (or any falsy value) downstream task(-s) would be marked as skipped, but this behavior is broken in 3.0.4 and fail pipeline with:
AirflowException: 'branch_task_ids' expected all task IDs are strings. Invalid tasks found: {(None, 'NoneType')}.

https://github.com/apache/airflow/pull/53431/files - I believe this change has brought an issue

What you think should happen instead?

We should skip downstream tasks as it used to be, even in tutorial None-s are part of the example - https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html#branching

How to reproduce

Use callable with return None for branching task

Operating System

Ubuntu 20.04.6 LTS

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions