Skip to content

DAG Run fails when chaining multiple empty mapped tasks #27824

@park-peter

Description

@park-peter

Apache Airflow version

2.4.3

What happened

A significant fraction of the DAG Runs of a DAG that has 2+ consecutive mapped tasks which are are being passed an empty list are marked as failed when all tasks are either succeeding or being skipped. This was supposedly fixed with issue #25200 but the problem still persists.
image

What you think should happen instead

The DAG Run should be marked success.

How to reproduce

The real world version of this DAG has several mapped tasks that all point to the same list, and that list is frequently empty. I have made a minimal reproducible example.

from datetime import datetime

from airflow import DAG
from airflow.decorators import task


with DAG(dag_id="break_mapping", start_date=datetime(2022, 3, 4)) as dag:

    @task
    def add_one(x: int):
        return x + 1

    @task
    def say_hi():
        print("Hi")

    @task
    def say_bye():
        print("Bye")

    added_values = add_one.expand(x=[])
    added_more_values = add_one.expand(x=[])
    added_more_more_values = add_one.expand(x=[])
    say_hi() >> say_bye() >> added_values
    added_values >> added_more_values >> added_more_more_values

Operating System

Debian Bullseye

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions