mnk
mnk

Reputation: 61

Airflow trigger tasks only based on previous runs status

Is there a way to trigger the next task based on previous task run states. Scenario as below:

enter image description here

Upvotes: 6

Views: 7872

Answers (1)

Christopher Beck
Christopher Beck

Reputation: 765

You have multiple options here:

  1. Use trigger rules, see trigger-rules on how to use them.
  2. Use on_failure_callback and on_success_callback to define what happens if your task fails/succeeds, see this post or the definitions in the BaseOperator API Reference (see Parameters -> on_failure_callback,on_success_callback).
  3. If you only want the emails to be sent in case of failure or SLA miss and no other task should be executed in that case, define:
    default_args = {'email': ['some_email_adress'],'email_on_failure': True"}, airflow will then send an email with the error/sla miss to the defined emails.

Upvotes: 2

Related Questions