CommencerCommencer gratuitement

Définir un SLA de tâche

Après avoir mis en place le SLA sur l’ensemble du workflow, vous réalisez que vous avez seulement besoin d’un SLA sur une tâche spécifique, et non sur tout le workflow.

Les bibliothèques Airflow appropriées sont déjà importées pour vous.

Cet exercice fait partie du cours

Introduction à Apache Airflow en Python

Afficher le cours

Instructions

  • Importez l’objet timedelta.
  • Ajoutez un sla de 3 heures à la tâche.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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)
Modifier et exécuter le code