Chime 通知操作指南¶
简介¶
Chime 通知器 ( airflow.providers.amazon.aws.notifications.chime.ChimeNotifier
) 允许用户通过 webhook 使用各种 on_*_callbacks
在 DAG 级别和任务级别向 Chime 聊天室发送消息。
示例代码:¶
from datetime import datetime
from airflow import DAG
from airflow.providers.standard.operators.bash import BashOperator
from airflow.providers.amazon.aws.notifications.chime import send_chime_notification
with DAG(
dag_id="mydag",
schedule="@once",
start_date=datetime(2023, 6, 27),
on_success_callback=[
send_chime_notification(chime_conn_id="my_chime_conn", message="The DAG {{ dag.dag_id }} succeeded")
],
catchup=False,
):
BashOperator(
task_id="mytask",
on_failure_callback=[
send_chime_notification(chime_conn_id="my_chime_conn", message="The task {{ ti.task_id }} failed")
],
bash_command="fail",
)