Skip to content

Mapping over multiple parameters results in 1 task fewer than expected #23425

@aspain

Description

@aspain

Apache Airflow version

2.3.0 (latest released)

What happened

While testing the example given for Mapping over multiple parameters I noticed only 5 tasks are being mapped rather than the expected 6.

task example from the doc:

    @task
    def add(x: int, y: int):
        return x + y


    added_values = add.expand(x=[2, 4, 8], y=[5, 10])

The doc mentions:

# This results in the add function being called with
# add(x=2, y=5)
# add(x=2, y=10)
# add(x=4, y=5)
# add(x=4, y=10)
# add(x=8, y=5)
# add(x=8, y=10)

But when I create a DAG with the example, only 5 tasks are mapped instead of 6:
image

What you think should happen instead

A task should be mapped for all 6 possible outcomes, rather than only 5

How to reproduce

Create a DAG using the example provided [here](Mapping over multiple parameters) and check the number of mapped instances:
image

Operating System

macOS 11.5.2

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==3.3.0
apache-airflow-providers-celery==2.1.4
apache-airflow-providers-cncf-kubernetes==4.0.1
apache-airflow-providers-databricks==2.6.0
apache-airflow-providers-elasticsearch==3.0.3
apache-airflow-providers-ftp==2.1.2
apache-airflow-providers-google==6.8.0
apache-airflow-providers-http==2.1.2
apache-airflow-providers-imap==2.2.3
apache-airflow-providers-microsoft-azure==3.8.0
apache-airflow-providers-postgres==4.1.0
apache-airflow-providers-redis==2.0.4
apache-airflow-providers-slack==4.2.3
apache-airflow-providers-snowflake==2.6.0
apache-airflow-providers-sqlite==2.1.3

Deployment

Astronomer

Deployment details

Localhost instance of Astronomer Runtime 5.0.0

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

Relationships

None yet

Development

No branches or pull requests

Issue actions