Skip to content

Commit

Permalink
Merge pull request #39 from datacoves/fix-airflow-slack-notifications
Browse files Browse the repository at this point in the history
Fix: Airflow Slack webhook notifications
  • Loading branch information
BAntonellini authored Aug 5, 2024
2 parents 48d1b1d + 9ac7721 commit acbbba7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docs/how-tos/airflow/send-slack-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ TRANSFORM_CONFIG = {
),
}

run_inform_success = send_slack_webhook_notification(
slack_webhook_conn_id="SLACK_NOTIFICATIONS", # Slack integration name slug -- double check in Datacoves integrations' admin
text="The dag {{ dag.dag_id }} succeeded",
)

run_inform_failure = send_slack_webhook_notification(
slack_webhook_conn_id="SLACK_NOTIFICATIONS", text="The dag {{ dag.dag_id }} failed"
)

@dag(
default_args={
Expand All @@ -129,12 +137,8 @@ TRANSFORM_CONFIG = {
schedule_interval="0 0 1 */12 *",
tags=["version_2", "slack_notification", "blue_green"],
catchup=False,
on_success_callback=send_slack_webhook_notification(
slack_webhook_conn_id="SLACK_NOTIFICATIONS", text="The dag {{ dag.dag_id }} succeeded"
),
on_failure_callback=send_slack_webhook_notification(
slack_webhook_conn_id="SLACK_NOTIFICATIONS", text="The dag {{ dag.dag_id }} failed"
),
on_success_callback=[run_inform_success],
on_failure_callback=[run_inform_failure],
)
def yaml_slack_dag():
transform = DatacovesDbtOperator(
Expand Down

0 comments on commit acbbba7

Please sign in to comment.