Defining a task SLA
After completing the SLA on the entire workflow, you realize you really only need the SLA timing on a specific task instead of the full workflow.
The appropriate Airflow libraries are imported for you.
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Import the
timedelta
object. - Add a 3 hour
sla
to the task.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the timedelta object
____
test_dag = DAG('test_workflow', start_date=datetime(2024,1,20), schedule_interval=None)
# Create the task with the SLA
task1 = BashOperator(task_id='first_task',
____=____,
bash_command='initialize_data.sh',
dag=test_dag)