Is it possible to trigger an email notification based on a conditional statement in Python without exiting the process?
Specifically, I have a robustness check in my prediction pipeline that performs simple imputation when encountering missing data. This check is very rarely needed, but it becomes necessary when a new entity is forecasted and one of the input tables hasn't been updated properly. In those instances, I much rather using an imputing strategy than breaking the whole pipeline but I want to be alerted when this occurs so I can investigate and update the problematic data if necessary.
I know this can be achieved by writing a function to send an email, with a separate job or with many other ways but I'm wondering if there's a way to do this using the dbutils package, similar to dbutils.notebook.exit(). Is there a function that inherits the job notification parameters that we could leverage to send this information? I feel like this would be much cleaner, but let me know if you see an issue with this practice.
Thanks for your time!