Skip to content

retries from default_args are not respected #57792

@ktaborski

Description

@ktaborski

Apache Airflow version

3.1.1

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

No response

What happened?

In my airflow.cfg I have:

[core]
...
default_task_retries = 3
...

This is example DAG:

from datetime import datetime
from airflow.sdk import DAG
from airflow.providers.standard.operators.bash import BashOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2024, 1, 1),
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 0,
}

dag = DAG(
    'test_dag',
    default_args=default_args,
    description='Test DAG that echoes a message and fails',
    schedule=None,
    catchup=False,
    tags=['test'],
)

test_task = BashOperator(
    task_id='echo_and_fail',
    bash_command='echo "This is a test message" && exit 1',
    dag=dag,
)

test_task is executed 4 times (1 + 3 retries), although in default_args I have 'retries': 0.

In version 3.0.6 it is working as expected

What you think should happen instead?

Task should be executed only once.

How to reproduce

Steps provided in description

Operating System

EKS bottlerocket

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

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

Relationships

None yet

Development

No branches or pull requests

Issue actions