email_on_failure not being sent

2,897 views
Skip to first unread message

gil...@google.com

unread,
Jun 13, 2018, 4:03:28 PM6/13/18
to cloud-composer-discuss
I have followed the doc and set up an environment with environment variables set for SENDGRID_MAIL_FROM and SENDGRID_API_KEY.

I then created a DAG with default_args like:

default_args = {
 
'owner': 'airflow',
 
'depends_on_past': False,
 
'start_date': START,
 
'email': [EMAIL],
 
'email_on_failure': True,
 
'email_on_retry': True,
 
'retries': 1
}

and assigned a task to the dag like:

t1 = BashOperator(
  task_id
='always_fail',
  bash_command
='exit(1)',
  dag
=dag
)


this task purposefully always fails because I want to see that the email is sent/received; however I am not receiving the notification and I am unable to verify whether airflow is having an issue sending the email, or why it is not reaching the end destination. How would I go about debugging?

Aron Long

unread,
Jun 14, 2018, 8:25:14 AM6/14/18
to gil...@google.com, cloud-composer-discuss
Hello,
  I just had my first email sent on failure.  The difference between my DAG and yours, I am using a hard coded email address.  

    'owner': 'Aron Long',
    'depends_on_past': False,
    'start_date': datetime(2018, 6, 12),
    'email': ['Te...@ifmrestoration.com'],
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    # 'queue': 'bash_queue',
    # 'pool': 'backfill',
    # 'priority_weight': 10,
    # 'end_date': datetime(2016, 1, 1),
}

My first thought, try to remove your variable of EMAIL and hard code your email address.  Second, you might need to look how your variable is defined.  I saw one example the variable of EMAIL is defined as 'Te...@IFMRestoration.com' and one defined as Te...@IFMRestoration.com.  Not sure if the variable assignment needs the single quote or not.  I believe it does.

As for logging, take a look inside your Cloud Composer Storage bucket.  It's the same area as your DAG folder but one level up.  My error message last night, pointed me to the logs folder.  You will see all your DAG names.  If you keep drilling in, you will find the logs files.  Maybe their is some information there.

Please keep me posted on what you find,  I am very new to this process!

Thanks!


--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
To post to this group, send email to cloud-composer-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/73e13573-5589-46b0-a796-8bb0f544aad7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Crystal Qian

unread,
Jun 16, 2018, 4:25:23 PM6/16/18
to al...@ifmrestoration.com, gil...@google.com, cloud-compo...@googlegroups.com
Hi!

A few debugging suggestions:

1) Head into your Airflow UI. Can you verify that your task is being scheduled, run, and failed?
2) Verify that your SENDGRID_MAIL_FROM is an email alias like 'foo@' and the SENDGRID_API_KEY is correct. Check out your Sendgrid usage stats here: https://app.sendgrid.com/statistics. Does it look like e-mails are being sent?
3) I had an issue with Sendgrid e-mails being sent to my Spam folder at first. Could this be the case?

Let me know if this helps. Also, feel free to PM me additional project/environment details if you'd like help with debugging. 😊

Crystal 

To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-di...@googlegroups.com.
To post to this group, send email to cloud-compo...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-di...@googlegroups.com.
To post to this group, send email to cloud-compo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/CALO7d_Q1uc4%3D3ogQpaeyVn5pFY2OUEPA0rWPrib1Zv1v_0yCow%40mail.gmail.com.

Aron Long

unread,
Jun 16, 2018, 6:28:43 PM6/16/18
to gil...@google.com, cloud-composer-discuss
On Thu, Jun 14, 2018 at 7:25 AM, Aron Long <al...@ifmrestoration.com> wrote:
Hello,
  I just had my first email sent on failure.  The difference between my DAG and yours, I am using a hard coded email address.  

    'owner': 'Aron Long',
    'depends_on_past': False,
    'start_date': datetime(2018, 6, 12),
    'email': ['Te...@ifmrestoration.com'],
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    # 'queue': 'bash_queue',
    # 'pool': 'backfill',
    # 'priority_weight': 10,
    # 'end_date': datetime(2016, 1, 1),
}

My first thought, try to remove your variable of EMAIL and hard code your email address.  Second, you might need to look how your variable is defined.  I saw one example the variable of EMAIL is defined as 'Te...@IFMRestoration.com' and one defined as Te...@IFMRestoration.com.  Not sure if the variable assignment needs the single quote or not.  I believe it does.

As for logging, take a look inside your Cloud Composer Storage bucket.  It's the same area as your DAG folder but one level up.  My error message last night, pointed me to the logs folder.  You will see all your DAG names.  If you keep drilling in, you will find the logs files.  Maybe their is some information there.

Please keep me posted on what you find,  I am very new to this process!

Thanks!

On Wed, Jun 13, 2018 at 3:03 PM, giladn via cloud-composer-discuss <cloud-composer-discuss@googlegroups.com> wrote:
I have followed the doc and set up an environment with environment variables set for SENDGRID_MAIL_FROM and SENDGRID_API_KEY.

I then created a DAG with default_args like:

default_args = {
 
'owner': 'airflow',
 
'depends_on_past': False,
 
'start_date': START,
 
'email': [EMAIL],
 
'email_on_failure': True,
 
'email_on_retry': True,
 
'retries': 1
}

and assigned a task to the dag like:

t1 = BashOperator(
  task_id
='always_fail',
  bash_command
='exit(1)',
  dag
=dag
)


this task purposefully always fails because I want to see that the email is sent/received; however I am not receiving the notification and I am unable to verify whether airflow is having an issue sending the email, or why it is not reaching the end destination. How would I go about debugging?

--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsubscri...@googlegroups.com.

gil...@google.com

unread,
Jun 18, 2018, 2:02:52 PM6/18/18
to cloud-composer-discuss
Thanks - I set up the SENDGRID_EMAIL_FROM incorrectly.. 99% of the time its a little thing. Thanks for your replies!
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages