MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Apache Airflow in Python

Lihat Kursus

Petunjuk latihan

  • Import the timedelta object.
  • Add a 3 hour sla to the task.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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)
Edit dan Jalankan Kode