โ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-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
โ09-04-2024 04:19 AM
you can do some hack arround
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group