Complete the code to import the DAG class from Airflow.
from airflow.[1] import DAG
The DAG class is imported from the models module in Airflow.
Complete the code to set the DAG's start date using datetime.
from datetime import datetime start_date = datetime([1])
The datetime constructor takes year, month, day as integers in that order.
Fix the error in the DAG definition by completing the default_args dictionary key for retries.
default_args = {
'owner': 'airflow',
'start_date': start_date,
'retries': [1]
}The retries value must be an integer, not a string or boolean.
Fill both blanks to create a DAG object with id 'example_dag' and schedule interval '@daily'.
dag = DAG(
dag_id=[1],
schedule_interval=[2]
)The dag_id should be the string 'example_dag' and the schedule_interval '@daily' for daily runs.
Fill all three blanks to define a PythonOperator task named 'print_date' that calls the 'print_date' function and uses the DAG object.
from airflow.operators.python import PythonOperator def print_date(): print('Current date') print_date_task = PythonOperator( task_id=[1], python_callable=[2], dag=[3] )
The task_id is the string 'print_date', the python_callable is the function print_date, and the dag is the DAG object named dag.