You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/09 05:43:14 UTC

[GitHub] [airflow] sharad-vm opened a new issue #12190: Send email notification on DAG success

sharad-vm opened a new issue #12190:
URL: https://github.com/apache/airflow/issues/12190


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   **Description**
   
   Airflow currently sends notifications on DAG failures. This feature request is to apply the same behavior to DAG successes as well, as an option. The default could be set to False. 
   
   
   **Use case / motivation**
   
   To ensure that the DAGs run as scheduled. 
   
   <!-- What do you want to happen?
   
   Rather than telling us how you might implement this solution, try to take a
   step back and describe what you are trying to achieve.
   
   -->
   
   **Related Issues**
   
   <!-- Is there currently another issue associated with this? -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek edited a comment on issue #12190: Send email notification on DAG success

Posted by GitBox <gi...@apache.org>.
turbaszek edited a comment on issue #12190:
URL: https://github.com/apache/airflow/issues/12190#issuecomment-723897026


   Users can use custom `on_success_callback` to achieve this behaviour: 
   
   ```py
   from airflow.utils.email import send_email
   
   def on_success_callback(context):
       ti: TaskInstance = context["ti"]
       dag_id = ti.dag_id
       task_id = ti.task_id
   
       msg = "DAG succeeded"
       subject = f"Success {dag_id}.{task_id}"
       send_email(to=EMAIL_LIST, subject=subject, html_content=msg)
   ```
   
   Personally I prefer this generic approach - users can customise the subject, title and what ever they want to fit their needs.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal closed issue #12190: Send email notification on DAG success

Posted by GitBox <gi...@apache.org>.
eladkal closed issue #12190:
URL: https://github.com/apache/airflow/issues/12190


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on issue #12190: Send email notification on DAG success

Posted by GitBox <gi...@apache.org>.
turbaszek commented on issue #12190:
URL: https://github.com/apache/airflow/issues/12190#issuecomment-723897026


   Users can use custom `on_success_callback` to achieve this behaviour: 
   
   ```
   from airflow.utils.email import send_email
   
   def on_success_callback(context):
       ti: TaskInstance = context["ti"]
       dag_id = ti.dag_id
       task_id = ti.task_id
   
       msg = "DAG succeeded"
       subject = f"Success {dag_id}.{task_id}"
       send_email(to=EMAIL_LIST, subject=subject, html_content=msg)
   ```
   
   Personally I prefer this generic approach - users can customise the subject, title and what ever they want to fit their needs.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #12190: Send email notification on DAG success

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #12190:
URL: https://github.com/apache/airflow/issues/12190#issuecomment-723770643


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org