HomeElementl

email pipeline_failure_sensor

Description

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:

image.png (2×1 px, 400 KB)

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:

  1. ask for env vars instead
  2. to have an entry in the Dagster instance yaml to get those types of configs/tokens.

Test Plan:
toy sensor and got emails

Screen Shot 2021-06-24 at 12.56.32 PM.png (784×1 px, 153 KB)

Reviewers: sandyryza, prha, owen

Reviewed By: sandyryza

Differential Revision: https://dagster.phacility.com/D8516

Details

Provenance
yuhanAuthored on Jun 24 2021, 8:11 PM
Reviewer
sandyryza
Differential Revision
D8516: email pipeline_failure_sensor
Parents
R1:fe4cae33421e: [crag][op] remove support for lists of ins and outs
Branches
Unknown
Tags
Unknown