Complete the code to import the Airflow DAG class.
from airflow.[1] import DAG
The DAG class is imported from the models module in Airflow.
Complete the code to define the default arguments for the DAG.
default_args = {
'owner': 'airflow',
'start_date': [1]
}The start_date should be a fixed datetime object, not a dynamic one like datetime.now().
Fix the error in the task definition by completing the operator import.
from airflow.operators.[1] import BashOperator task = BashOperator( task_id='print_date', bash_command='date' )
The BashOperator is imported from the bash module inside operators.
Fill both blanks to create a SparkSubmitOperator task with the correct application path and task ID.
from airflow.providers.apache.spark.operators.spark_submit import SparkSubmitOperator spark_task = SparkSubmitOperator( task_id='[1]', application='[2]' )
The task_id should be a simple string identifier like spark_job. The application parameter requires the full path to the Spark job script.
Fill all three blanks to define a DAG with a schedule interval, default args, and assign the Spark task to the DAG.
from airflow import DAG from datetime import datetime with DAG( dag_id='[1]', default_args=[2], schedule_interval='[3]' ) as dag: spark_task.dag = dag
The DAG ID is a string like spark_pipeline. The default_args dictionary is passed as is. The schedule interval can be a preset like @daily.
