Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove email configs, operator and callbacks #46041

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ repos:
language: pygrep
name: No providers imports in core example DAGs
description: The core example DAGs have no dependencies other than standard provider or core Airflow
entry: "^\\s*from airflow\\.providers.(?!standard.)"
# TODO: rewrite airflow/example_dags/example_dag_decorator.py and remove `smtp` provider exception
entry: "^\\s*from airflow\\.providers\\.(?!standard|smtp)"
pass_filenames: true
files: ^airflow/example_dags/.*\.py$
- id: check-no-airflow-deprecation-in-providers
Expand Down
7 changes: 0 additions & 7 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2680,13 +2680,6 @@ paths:

base_log_folder = /opt/airflow/logs


[smtp]

smtp_host = localhost

smtp_mail_from = [email protected]

'
'401':
content:
Expand Down
4 changes: 0 additions & 4 deletions airflow/api_fastapi/core_api/routes/public/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
[core]
dags_folder = /opt/airflow/dags
base_log_folder = /opt/airflow/logs

[smtp]
smtp_host = localhost
smtp_mail_from = [email protected]
"""
),
},
Expand Down
129 changes: 0 additions & 129 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2031,135 +2031,6 @@ webserver:
type: integer
example: ~
default: "1000"
email:
description: |
Configuration email backend and whether to
send email alerts on retry or failure
options:
email_backend:
description: Email backend to use
version_added: ~
type: string
example: ~
default: "airflow.utils.email.send_email_smtp"
email_conn_id:
description: Email connection to use
version_added: 2.1.0
type: string
example: ~
default: "smtp_default"
default_email_on_retry:
description: |
Whether email alerts should be sent when a task is retried
version_added: 2.0.0
type: boolean
example: ~
default: "True"
default_email_on_failure:
description: |
Whether email alerts should be sent when a task failed
version_added: 2.0.0
type: boolean
example: ~
default: "True"
subject_template:
description: |
File that will be used as the template for Email subject (which will be rendered using Jinja2).
If not set, Airflow uses a base template.
version_added: 2.0.1
type: string
example: "/path/to/my_subject_template_file"
default: ~
see_also: ":doc:`Email Configuration </howto/email-config>`"
html_content_template:
description: |
File that will be used as the template for Email content (which will be rendered using Jinja2).
If not set, Airflow uses a base template.
version_added: 2.0.1
type: string
example: "/path/to/my_html_content_template_file"
default: ~
see_also: ":doc:`Email Configuration </howto/email-config>`"
from_email:
description: |
Email address that will be used as sender address.
It can either be raw email or the complete address in a format ``Sender Name <[email protected]>``
version_added: 2.2.4
type: string
example: "Airflow <[email protected]>"
default: ~
ssl_context:
description: |
ssl context to use when using SMTP and IMAP SSL connections. By default, the context is "default"
which sets it to ``ssl.create_default_context()`` which provides the right balance between
compatibility and security, it however requires that certificates in your operating system are
updated and that SMTP/IMAP servers of yours have valid certificates that have corresponding public
keys installed on your machines. You can switch it to "none" if you want to disable checking
of the certificates, but it is not recommended as it allows MITM (man-in-the-middle) attacks
if your infrastructure is not sufficiently secured. It should only be set temporarily while you
are fixing your certificate configuration. This can be typically done by upgrading to newer
version of the operating system you run Airflow components on,by upgrading/refreshing proper
certificates in the OS or by updating certificates for your mail servers.
type: string
version_added: 2.7.0
example: "default"
default: "default"
smtp:
description: |
If you want airflow to send emails on retries, failure, and you want to use
the airflow.utils.email.send_email_smtp function, you have to configure an
smtp server here
options:
smtp_host:
description: |
Specifies the host server address used by Airflow when sending out email notifications via SMTP.
version_added: ~
type: string
example: ~
default: "localhost"
smtp_starttls:
description: |
Determines whether to use the STARTTLS command when connecting to the SMTP server.
version_added: ~
type: string
example: ~
default: "True"
smtp_ssl:
description: |
Determines whether to use an SSL connection when talking to the SMTP server.
version_added: ~
type: string
example: ~
default: "False"
smtp_port:
description: |
Defines the port number on which Airflow connects to the SMTP server to send email notifications.
version_added: ~
type: string
example: ~
default: "25"
smtp_mail_from:
description: |
Specifies the default **from** email address used when Airflow sends email notifications.
version_added: ~
type: string
example: ~
default: "[email protected]"
smtp_timeout:
description: |
Determines the maximum time (in seconds) the Apache Airflow system will wait for a
connection to the SMTP server to be established.
version_added: 2.0.0
type: integer
example: ~
default: "30"
smtp_retry_limit:
description: |
Defines the maximum number of times Airflow will attempt to connect to the SMTP server.
version_added: 2.0.0
type: integer
example: ~
default: "5"
sentry:
description: |
`Sentry <https://docs.sentry.io>`__ integration. Here you can supply
Expand Down
4 changes: 0 additions & 4 deletions airflow/config_templates/unit_tests.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ allowed_deserialization_classes = airflow.* tests.*
# celery tests rely on it being set
celery_logging_level = INFO

[smtp]
# Used as default values for SMTP unit tests
smtp_mail_from = [email protected]

[api]
auth_backends = airflow.providers.fab.auth_manager.api.auth.backend.session

Expand Down
7 changes: 0 additions & 7 deletions airflow/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,6 @@ def inversed_deprecated_sections(self):
"navbar_color": (re2.compile(r"(?i)\A#007A87\z"), "#fff", "2.1"),
"dag_default_view": (re2.compile(r"^tree$"), "grid", "3.0"),
},
"email": {
"email_backend": (
re2.compile(r"^airflow\.contrib\.utils\.sendgrid\.send_email$"),
r"airflow.providers.sendgrid.utils.emailer.send_email",
"2.1",
),
},
"logging": {
"log_filename_template": (
re2.compile(re2.escape("{{ ti.dag_id }}/{{ ti.task_id }}/{{ ts }}/{{ try_number }}.log")),
Expand Down
3 changes: 0 additions & 3 deletions airflow/example_dags/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
# You can override them on a per-task basis during operator initialization
default_args={
"depends_on_past": False,
"email": ["[email protected]"],
"email_on_failure": False,
"email_on_retry": False,
"retries": 1,
"retry_delay": timedelta(minutes=5),
# 'queue': 'bash_queue',
Expand Down
7 changes: 0 additions & 7 deletions airflow/models/baseoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,6 @@ class derived from this one results in the creation of a task object,
:param task_id: a unique, meaningful id for the task
:param owner: the owner of the task. Using a meaningful description
(e.g. user/person/team/role name) to clarify ownership is recommended.
:param email: the 'to' email address(es) used in email alerts. This can be a
single email or multiple ones. Multiple addresses can be specified as a
comma or semicolon separated string or by passing a list of strings.
:param email_on_retry: Indicates whether email alerts should be sent when a
task is retried
:param email_on_failure: Indicates whether email alerts should be sent when
a task failed
:param retries: the number of retries that should be performed before
failing the task
:param retry_delay: delay between retries, can be set as ``timedelta`` or
Expand Down
Loading
Loading