Email notification on failure

Configure an Apache Airflow DAG to notify by using email on failure in Cloud Composer.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


from airflow import models
default_dag_args = {
    'start_date': yesterday,
    # Email whenever an Operator in the DAG fails.
    'email': models.Variable.get('email'),
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': datetime.timedelta(minutes=5),
    'project_id': project_id

with models.DAG(
        default_args=default_dag_args) as dag:

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.