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

Schedule a DAG via Python

You've learned quite a bit about creating DAGs, but now you would like to schedule a specific DAG on a specific day of the week at a certain time. You'd like the code include this information in case a colleague needs to reinstall the DAG to a different server.

The Airflow DAG object and the appropriate datetime methods have been imported for you.

Bu egzersiz

Introduction to Apache Airflow in Python

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

Egzersiz talimatları

  • Set the start date of the DAG to November 1, 2023.
  • Configure the retry_delay to 20 minutes. You will learn more about the timedelta object in Chapter 3. For now, you just need to know it expects an integer value.
  • Use the cron syntax to configure a schedule of every Wednesday at 12:30pm.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Update the scheduling arguments as defined
default_args = {
  'owner': 'Engineering',
  'start_date': datetime(____, ____, ____),
  'email': ['[email protected]'],
  'email_on_failure': False,
  'email_on_retry': False,
  'retries': 3,
  'retry_delay': timedelta(minutes=____)
}

dag = DAG('update_dataflows', default_args=default_args, schedule_interval='____')
Kodu Düzenle ve Çalıştır