Problem
When using Databricks Asset Bundles (DABs), you want to set two distinct email notifications for when a DAB job is correctly executed and when it fails. You don’t see how to set these notifications in the UI.
Cause
When using a DAB for a job, the UI will not display all properties. Setting email notifications is not available in the UI by design. Instead, it is best to set email configurations using YAML syntax.
Solution
To configure email notifications for jobs.on_success
and jobs.on_failure
within Databricks Asset Bundles (DAB), use the UI to switch to code version and use YAML syntax.
- In the workspace UI, find your existing DAB job.
- In the top right button Run Now, click on the down arrow on the right and choose the option Switch to code version (YAML), as shown in the following image.
- Add your YAML code to set the notification. The following code is a sample of the YAML configuration that includes email notification for both the job run, under jobs and the task, under tasks.
resources:
jobs:
Sample_Job_2025_01_16:
name: Sample Job 2025-01-16
email_notifications:
on_success:
- <email-address>
on_failure:
- <email-address>
tasks:
- task_key: sample_task
notebook_task:
notebook_path: /Workspace/Users/<username>/<sample-notebook>
source: WORKSPACE
email_notifications:
on_success:
- <email-address>
on_failure:
- <email-address>
queue:
enabled: true