-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Description
Apache Airflow version
3.1.4 (also affects 3.0.x, 3.1.x)
What happened?
The configuration option default_email_on_failure (and default_email_on_retry) is documented in the Configuration Reference and present in the config template, but the Airflow 3 SDK does not read this value.
Configuration (documented and present in config template):
# config_templates/config.yml
default_email_on_failure:
description: |
Whether email alerts should be sent when a task failed
version_added: 2.0.0
type: boolean
default: "True"SDK behavior (ignores config):
# airflow/sdk/bases/operator.py - Line 217
OPERATOR_DEFAULTS: dict[str, Any] = {
"email_on_failure": True, # Hardcoded, does not read from config
"email_on_retry": True,
}Airflow 2.x behavior (read from config):
# airflow/models/baseoperator.py
email_on_failure: bool = conf.getboolean("email", "default_email_on_failure", fallback=True)What you think should happen instead?
One of the following:
-
Option A (Preferred): The SDK should read the config value like Airflow 2.x did, maintaining backward compatibility for users who set these configs.
-
Option B: If the config is intentionally no longer used, it should be marked as deprecated in the configuration reference and config template, with a note directing users to set
email_on_failureexplicitly indefault_argsinstead.
Currently there's an inconsistency:
- The operator parameters (
email,email_on_failure) are deprecated with warnings pointing toSmtpNotifier(PR Deprecating email, email_on_retry, email_on_failure in BaseOperator #47146) - The config options (
default_email_on_failure) are still documented without deprecation notices, but are silently ignored
How to reproduce
-
Set environment variable:
export AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE=False -
Create a DAG with
emailset but no explicitemail_on_failure:default_args = { "email": ["team@example.com"], # email_on_failure not set - should inherit from config }
-
Trigger a task failure
-
Expected (Airflow 2.x behavior): No email sent (config is
False) -
Actual (Airflow 3.x behavior): Email attempted (SDK hardcodes
True)
Operating System
Linux / macOS
Versions of Apache Airflow Providers
N/A - core issue
Deployment
Docker-Compose, Kubernetes (Helm)
Deployment details
No response
Anything else?
Related:
- PR Deprecating email, email_on_retry, email_on_failure in BaseOperator #47146 deprecated the operator parameters but didn't address the config options
- The mailing list discussion "[DISCUSS] Drop email integration from Airflow Core" focused on operator-level changes
Workaround: Explicitly set email_on_failure=False in default_args:
default_args = {
"email": ["team@example.com"],
"email_on_failure": False, # Must be explicit in Airflow 3
}Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct