email pipeline_failure_sensor
Summary:
Similar to D8510, this diff provides out-of-box support for sending emails on pipeline failures over the SMTP
This is thin layer that doesn't address advanced (more secure) email auth connection.
So if an OSS user wants a more secure mechanism we could direct them to write their own.
from dagster import repository from dagster.utils.email import make_email_on_pipeline_failure_sensor email_on_pipeline_failure = make_email_on_pipeline_failure_sensor( email_from=os.getenv("ALERT_EMAIL_ADDRESS"), email_password=os.getenv("ALERT_EMAIL_PASSWORD"), email_to=["yuhan@elementl.com"], dagit_base_url="http://localhost", ) @repository def my_repo(): return [my_pipeline, email_on_pipeline_failure]
api doc:
One thing is open for discussion is how we get the email creds like sender email password.
This diff asks users to put sender email and password directly.
Alternatives are:
- ask for env vars instead
- to have an entry in the Dagster instance yaml to get those types of configs/tokens.
Test Plan:
toy sensor and got emails
Reviewers: sandyryza, prha, owen
Reviewed By: sandyryza
Differential Revision: https://dagster.phacility.com/D8516