Di Ye
Di Ye

Reputation: 739

Notify after 2 consecutive task failures on Airflow

Is there a way to only notify/email on 2 consecutive task failures - we want a task to retry first if failed, and if the second try failed again, page. We don't want the email to be sent on the first failure, which Airflow's email_on_failure would do.

Upvotes: 0

Views: 346

Answers (1)

arcbjorn
arcbjorn

Reputation: 121

You might need to disable email_on_retry option and enable email_on_failure in default_Args.

DEFAULT_ARGS = {
    'owner': 'me',
    'depends_on_past': False,
    'email': ['[email protected]'],
    'email_on_failure': True,
    'retries': 2,
    'email_on_retry': False,
    'retry_delay': timedelta(seconds=5)
}

That will notify you after the task failed again

Upvotes: 2

Related Questions