1. Learn
  2. /
  3. คอร์ส
  4. /
  5. Introduction to Apache Airflow in Python

Connected

แบบฝึกหัด

Implementing a callback function

You've recently been assigned to add failure callbacks to the Dags created by your team. To start, you'd like to add a simple failure callback that writes a message to the audit log when the sales_etl_dag fails.

The dag and task objects are already imported and the get_sales_data and process_sales_data tasks have been created.

คำแนะนำ

100 XP
  • Create a callback function named alert_on_failure.
  • Define the function to accept any objects Airflow passes to it.
  • Specify a failure callback using the alert_on_failure function.