ā02-01-2022 11:38 PM
ā02-02-2022 06:39 AM
try:
...
except Exception as error:
dbutils.notebook.exit(str(jobId) + ' - ERROR!!! - ' + repr(error))
ā02-03-2022 08:52 PM
Would it work if we are not running notebook based jobs?
ā02-07-2022 07:21 AM
Hi @karthick Jā , This link shall help you.
ā02-10-2022 01:29 AM
Thanks for sharing the link. It doesn't help much for the case.
ā03-01-2022 05:57 PM
Hi @karthick Jā ,
Please try the code below:
# Errors in workflows thrown a WorkflowException.
def run_with_retry(notebook, timeout, args = {}, max_retries = 3):
num_retries = 0
while True:
try:
return dbutils.notebook.run(notebook, timeout, args)
except Exception as e:
if num_retries > max_retries:
raise e
else:
print("Retrying error", e)
num_retries += 1
run_with_retry("LOCATION_OF_CALLEE_NOTEBOOK", 60, max_retries = 5)
For more info please check the docs https://docs.databricks.com/notebooks/notebook-workflows.html#handle-errors
ā04-22-2022 07:28 AM
Hi @karthick Jā
Hope you are well.
Just wanted to see if you were able to find an answer to your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly?
Cheers!
ā04-26-2022 04:06 AM
No, didnt get the solution. Maybe there isnt one for this use case.
ā12-15-2022 07:43 AM
Hi,
I've build a job on a python wheel and I've obtained the opposite behaviour (the job failed). I'm using a try/except like your. I've also tried to create a job from a simple notebook and now the job succeded!
Someone knows why the behaviour changes in relation to the format?
ā05-04-2023 03:06 AM
Instead of exiting the notebook which make the task/job success, Exception objects needs to be raised again from Exception block to fail the job.
try:
<you code>
except Exception as err:
<your block of exception handling>
raise err
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.