diff --git a/airflow/dags/sync_kernel_to_website.py b/airflow/dags/sync_kernel_to_website.py index 3f57e45d..68aa35b8 100644 --- a/airflow/dags/sync_kernel_to_website.py +++ b/airflow/dags/sync_kernel_to_website.py @@ -10,6 +10,7 @@ from airflow.models import Variable from airflow.operators.python_operator import PythonOperator, ShortCircuitOperator from airflow.operators.dagrun_operator import TriggerDagRunOperator +from airflow.operators.email_operator import EmailOperator from opac_schema.v1 import models @@ -22,7 +23,15 @@ ) from common.hooks import mongo_connect, kernel_connect +email_notification_recipients = os.environ.get( + "EMAIL_NOTIFICATION_RECIPIENTS", None) + +EMAIL_NOTIFICATION_RECIPIENTS = ( + email_notification_recipients.split(",") if email_notification_recipients else [] +) + failure_recipients = os.environ.get("EMIAL_ON_FAILURE_RECIPIENTS", None) + EMIAL_ON_FAILURE_RECIPIENTS = ( failure_recipients.split(",") if failure_recipients else [] ) @@ -915,6 +924,15 @@ def register_last_issues(ds, **kwargs): dag=dag, ) +send_notification_email = EmailOperator( + task_id='send_notification_email', + to=EMAIL_NOTIFICATION_RECIPIENTS, + subject='Site atualizado', + html_content="""