Forum Discussion
mssparkutils.notebook.runMultiple doesn't return notebook Status if notebook fails
- 2 years ago
These don't run in parallel. But i guess I can multithread for that. Essentially use something like what is documented here: https://learn.microsoft.com/en-us/azure/databricks/_extras/notebooks/source/parallel-notebooks.html
Hi anawast ,
It is possible to run each subnotebook in the main notebook using mssparkutils.notebook.run and capture the state of each subnotebook in the main notebook.
The code is as follows:
def run_notebook(notebook_path):
try:
mssparkutils.notebook.run(notebook_path, 3600)
return {"notebook": notebook_path, "status": "Success"}
except Exception as e:
return {"notebook": notebook_path, "status": "Failed", "error": str(e)}
notebooks = ["Notebook 2", "Notebook 8"]
results = [run_notebook(nb) for nb in notebooks]
# result
for result in results:
print(result)
Here is a screenshot of my successful run:
I've modified the code for notebook 8 a bit, here's a screenshot of one of the notebooks running and reporting an error, click on notebook 2 to see the result of a successful run.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
- jjaeger941 year agoHelper II
This will not run concurrently will it?
The benefit of run multiple is that it runs the notebooks in parallel