Create notification_config
In the root of your project’s folder (e.g.default_repo/), open the file
metadata.yaml.
Project folder name
If you initialized Mage using a different project name, then your root folder
will be named differently. default_repo is the default project name if you
didn’t customize it.
In the default_repo/metadata.yaml file, add a section with the following
configuration or update the existing notification_config section:
alert_on section it will default to trigger_failure and trigger_passed_sla.
Options:
trigger_failure: alert when a run of a trigger failstrigger_success: alert when a run of a trigger succeedstrigger_passed_sla: alert when a run of a trigger passes sla
Configure email settings
In thedefault_repo/metadata.yaml file, add a section with the following
configuration or update the existing notification_config section:
email_config section.
Customize message templates
You can customize message templates innotification_config. Here is an example config:
success, failure, passed_sla scenarios. For each message template,
you can specify title and either summary or details.
titleis used in email subject- If you specify the
summary, the email body will be yoursummary+ the url of the pipeline run page - If you specify the
details, thedetailswill be used as your email body
{variable_name} syntax.
Here are the supported variables:
execution_timepipeline_run_urlpipeline_schedule_idpipeline_schedule_namepipeline_schedule_descriptionpipeline_uuiderror- available only for the
failuremessage template
- available only for the
stacktrace- available only for the
failuremessage template
- available only for the
Note: Forpipeline_run_url, the default host ishttp://localhost:6789. You can specifyMAGE_PUBLIC_HOSTto be the host url you want to use in the notification messages.
🚀 Pro Only: Interpolate Mage Variables in Message Templates
Only in Mage Pro.Try our fully managed solution to access this advanced feature.
execution_time, pipeline_uuid, etc), you can also use the
following in your message templates in Mage Pro:
start_timeend_timeduration(in seconds)env(this gets the value stored in theENVenvironment variable)
What next?
Whenever a pipeline run is successfully completed or fails, an email will be delivered to all the inboxes listed underto_emails.
Here is an example of what an email could look like:
Successfully ran Pipeline example_pipeline with Trigger 79 hourly_trigger at execution time 2022-09-28 19:00:00.Open http://localhost:6789/pipelines/example_pipeline/triggers/79 to check pipeline run results and logs. |