---**airflow.cfg---**
[smtp]
# 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
smtp_host = smtp.gmail.com
smtp_starttls = True
smtp_ssl = False
# Example: smtp_user = airflow
smtp_user =
# Example: smtp_password = airflow
smtp_password =
smtp_port = 587
smtp_mail_from =
smtp_timeout = 30
smtp_retry_limit = 5
---dag---
from airflow.operators.email import EmailOperator
send_email_notification = EmailOperator(
task_id="send_email_notification",
to="airflow@airflow.com",
subject="forex_data_pipeline",
html_content="<h3>fored_data_pipeline</h3>"
)
slack
from airflow.providers.slack.operators.slack_webhook import SlackWebhookOperator
def _get_message() -> str:
return "Hi from forex_data_pipeline"
send_slack_notification = SlackWebhookOperator(
task_id="send_slack_notification",
http_conn_id="slack_conn",
message=_get_message(),
channel="#monitoring"
)
----slack_conn----
type:http
password:webhook url
'Data Engineering > Airflow' 카테고리의 다른 글
Airflow save(hdfs) create(hive-table) processing(spark) (0) | 2022.03.07 |
---|---|
Airflow Sensor Operator (0) | 2022.03.07 |
Airflow Docker로 구성해보기 (0) | 2022.03.07 |
Airflow task group, xcom, trigger rule (0) | 2022.03.07 |
Airflow Scale up (0) | 2022.03.07 |