Thanks for reaching out to Microsoft Q&A.
I tried the same with your code and my Notebook is also gave me Success.
Here, you are handling the error and passing a message to the notebook using.
dbutils.notebook.exit(msg).
Notebook won't fail when it exited with a message but the databricks notebook execution will be aborted.
If you want to get the reason(Message) causing the abort of the databricks notebook in the ADF pipeline, use the below expression after the Success of the notebook activity.
@activity('Notebook1').output.runOutput
(OR)
If you want Notebook activity to fail, you need to generate the error and abort the notebook like below sample.
try:
try:
df = spark.sql(query)
df.write.format(formato).mode(method).saveAsTable(table)
except Exception as e:
msg = "An error occured while writing the query to the table: {}".format(e)
logging.error(msg)
raise
Now, to get the error message in ADF, use the below expression after the Failure of the Notebook activity.
@activity('Notebook1').output.runError
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.