-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove email conigs, operator and callbacks
- Loading branch information
1 parent
dd2252d
commit 037adbf
Showing
33 changed files
with
99 additions
and
1,558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2488,22 +2488,12 @@ paths: | |
options: | ||
- key: dags_folder | ||
value: /home/user/my-dags-folder | ||
|
||
- name: smtp | ||
options: | ||
- key: smtp_host | ||
value: localhost | ||
- key: smtp_mail_from | ||
value: [email protected] | ||
text/plain: | ||
schema: | ||
type: string | ||
example: | | ||
[core] | ||
dags_folder = /home/user/my-dags-folder | ||
[smtp] | ||
smtp_host = localhost | ||
smtp_mail_from = [email protected] | ||
"401": | ||
$ref: "#/components/responses/Unauthenticated" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2672,13 +2672,6 @@ paths: | |
base_log_folder = /opt/airflow/logs | ||
[smtp] | ||
smtp_host = localhost | ||
smtp_mail_from = [email protected] | ||
' | ||
'401': | ||
content: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
""" | ||
), | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
from airflow.decorators import dag, task | ||
from airflow.models.baseoperator import BaseOperator | ||
from airflow.operators.email import EmailOperator | ||
from airflow.providers.smtp.operators.smtp import EmailOperator | ||
|
||
if TYPE_CHECKING: | ||
from airflow.sdk.definitions.context import Context | ||
|
@@ -48,11 +48,12 @@ def execute(self, context: Context): | |
catchup=False, | ||
tags=["example"], | ||
) | ||
def example_dag_decorator(email: str = "[email protected]"): | ||
def example_dag_decorator(to_email: str = "example1@example.com", from_email: str = "example2@example.com"): | ||
""" | ||
DAG to send server IP to email. | ||
:param email: Email to send IP to. Defaults to [email protected]. | ||
:param to_email: Email to send IP to. Defaults to [email protected]. | ||
:param from_email: Email to send IP from. Defaults to [email protected] | ||
""" | ||
get_ip = GetRequestOperator(task_id="get_ip", url="http://httpbin.org/get") | ||
|
||
|
@@ -67,7 +68,11 @@ def prepare_email(raw_json: dict[str, Any]) -> dict[str, str]: | |
email_info = prepare_email(get_ip.output) | ||
|
||
EmailOperator( | ||
task_id="send_email", to=email, subject=email_info["subject"], html_content=email_info["body"] | ||
task_id="send_email", | ||
to=to_email, | ||
from_email=from_email, | ||
subject=email_info["subject"], | ||
html_content=email_info["body"], | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.