3 weeks ago
Hello all, I am brand new to Databricks, so forgive me if this question has been answered before, but what i want to do is set a run time threshold to my Databricks Jobs such that if the job which say normally runs for 30 minutes, runs for over an hour, then i get an email notification.
I have found the Job-Notifications section within the Databricks Job, and I can set it there in the UI. But according to CoPilot, I cannot programmatically set this and as soon as i do a code deploy/rebuild, the values will get removed.
Is it true that I can't set these through code and that any manual set is wiped out?
It seems a bit weird to me as it kind of makes the Ui ability worthless? I have weekly deploys by the way which would mean a manual set every week if the above is true. Cheers all.
3 weeks ago
Hi @rwalrondNHS,
You can set these thresholds and notifications programmatically. They’re part of the normal Jobs definition, not a UI‑only feature. I've just tested this for a sample job and it works perfectly.
Under the hood, the run longer than X --> send email UI maps to the below
For example (Jobs API 2.1/2.2): This is the output I had from my sample job notification setting
{
"health": {
"rules": [
{
"metric": "RUN_DURATION_SECONDS",
"op": "GREATER_THAN",
"value": 60
}
]
},
"email_notifications": {
"on_duration_warning_threshold_exceeded": [
"ashXX.XXX@XXX.com"
]
}
}If your deployment pipeline uses jobs/create or jobs/reset and doesn’t include these fields in the JSON/YAML it sends, those UI‑configured values get overwritten by whatever is in code (which in that case is "nothing"). That’s not a limitation of the feature, it’s just “"nfra as code" doing what it’s supposed to do: the code is treated as the source of truth.
So..it’s not true that you can’t set them via code. You absolutely can (and should, if you have weekly deploys). However, manual UI tweaks will be wiped if your job‑as‑code definition omits them on each deploy.
The UI is still useful for interactive editing and discovery, but in a CI/CD setup you’ll want to copy those settings into your job JSON/Terraform/Bundles config so they persist across rebuilds.
Hope this helps.
If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.
3 weeks ago
The notification settings are determined either by the UI or by DAB (formerly known as databricks asset bundles).
In either case they represent a fixed value and not a relative one (like 2 times the time of the previous run).
DAB is not code but yml config. But as said: a fixed value, not a formula.
Basically you either use the UI or DAB, because if you use both, the one will overwrite the other.
That being said: I would use dab. it is not real code but with yml quite a lot is possible. But only fixed values though for this case.
3 weeks ago
Hi @rwalrondNHS,
You can set these thresholds and notifications programmatically. They’re part of the normal Jobs definition, not a UI‑only feature. I've just tested this for a sample job and it works perfectly.
Under the hood, the run longer than X --> send email UI maps to the below
For example (Jobs API 2.1/2.2): This is the output I had from my sample job notification setting
{
"health": {
"rules": [
{
"metric": "RUN_DURATION_SECONDS",
"op": "GREATER_THAN",
"value": 60
}
]
},
"email_notifications": {
"on_duration_warning_threshold_exceeded": [
"ashXX.XXX@XXX.com"
]
}
}If your deployment pipeline uses jobs/create or jobs/reset and doesn’t include these fields in the JSON/YAML it sends, those UI‑configured values get overwritten by whatever is in code (which in that case is "nothing"). That’s not a limitation of the feature, it’s just “"nfra as code" doing what it’s supposed to do: the code is treated as the source of truth.
So..it’s not true that you can’t set them via code. You absolutely can (and should, if you have weekly deploys). However, manual UI tweaks will be wiped if your job‑as‑code definition omits them on each deploy.
The UI is still useful for interactive editing and discovery, but in a CI/CD setup you’ll want to copy those settings into your job JSON/Terraform/Bundles config so they persist across rebuilds.
Hope this helps.
If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.
3 weeks ago
It absolutely does help, it is exactly what I was asking Copilot can i do this in Databricks. So i'm glad i asked here as well 🙂 Many thanks.