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 to 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.
Diese Übung ist Teil des Kurses
Einführung in Apache Airflow mit Python
Anleitung zur Übung
- Set the start date of the Dag to November 1, 2025.
- Use the cron syntax to configure a schedule of every Wednesday at 12:30pm.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
@dag(
dag_id='update_dataflows',
# Set to November 1, 2025
start_date=datetime(____),
# Every Wednesday at 12:30pm
schedule='____'
)
def update_dataflows():
@task
def pull_source_data():
pass
update_dataflows()