Skip to content

Mapped task_group does not output list of combined results to consumer #49714

@retsilla

Description

@retsilla

Apache Airflow version

3.0.0

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

No response

What happened?

When dynamically creating task groups and creating a task to consume combined results, the input received by the consuming task is None rather than a list of combined results.

What you think should happen instead?

According to the example in docs and behaviour in previous versions of Airflow the result passed to the consuming tasks should be a combined list of results from the task group instances.

How to reproduce

DAG derived from the example in the docs:

from datetime import datetime

from airflow.sdk import DAG, task, task_group

with DAG(
    dag_id="dynamic_task_group_dag",
    start_date=datetime(2025, 1, 1),
    schedule=None,
):

    @task_group
    def add_one_and_double(value: int):
        @task
        def add_one(value: int):
            return value + 1

        @task
        def double(value: int):
            return value * 2

        new_value = add_one(value)
        return double(new_value)

    @task
    def consumer(values: list[int]):
        print(f"New values are: {values}")

    results = add_one_and_double.expand(value=[1, 2, 3])
    consumer(results)  # Should receive [4, 6, 8] but gets null

Image

Logs of consumer task showing null was received:

[2025-04-24, 13:14:50] INFO - DAG bundles loaded: dags-folder: source="airflow.dag_processing.bundles.manager.DagBundlesManager"
[2025-04-24, 13:14:50] INFO - Filling up the DagBag from /home/airflow/dags/dynamic_task_group_dag.py: source="airflow.models.dagbag.DagBag"
[2025-04-24, 13:14:50] INFO - Done. Returned value was: None: source="airflow.task.operators.airflow.providers.standard.decorators.python._PythonDecoratedOperator"
[2025-04-24, 13:14:50] INFO - New values are: None: chan="stdout": source="task"

Operating System

Debian GNU/Linux 12

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

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions