BaşlayınÜcretsiz Başlayın

Generate and email a report

Airflow provides the ability to automate almost any style of workflow. You would like to receive a report from Airflow when tasks complete without requiring constant monitoring of the UI or log files. You decide to use the email functionality within Airflow to provide this message.

All the typical Airflow components have been imported for you, and a DAG is already defined as report_dag.

Bu egzersiz

Introduction to Apache Airflow in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Define the proper operator for the email_report task.
  • Fill the missing details for the Operator. Use the file named monthly_report.pdf.
  • Set the email_report task to occur after the generate_report task.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Define the email task
email_report = ____(
        task_id='email_report',
        to='[email protected]',
        subject='Airflow Monthly Report',
        html_content="""Attached is your monthly workflow report - please refer to it for more detail""",
        files=[____],
        ____=report_dag
)

# Set the email task to run after the report is generated
email_report ____ generate_report
Kodu Düzenle ve Çalıştır