Using this mssparkutils.notebook.runMultiple function to run notebook in parallel, how to find the failed notebook.

2025-01-29T09:02:16.5633333+00:00

Hi Team,

Could you please help us to find the failed notebook in parallel run using the below code, but not able to find the failed one.
Eg: If any notebook got failed it is stopping the processs, but we don't know which notebook failed
, can you please help us to provide code to find which notebook failed and how to print it.

# run multiple notebooks with parameters
DAG = {
    "activities": [
        
 
{"name": "Notebook1", "path": "notebook1", "timeoutPerCellInSeconds": 120},
{"name": "notebbok2", "path": "notebbok2", "timeoutPerCellInSeconds": 120},
{"name": "notebook3", "path": "notebook3", "timeoutPerCellInSeconds": 120},
{"name": "notebbok4", "path": "notebbok4", "timeoutPerCellInSeconds": 120},
  

    ]
}
try:
    mssparkutils.notebook.runMultiple(DAG)
except:
    print(DAG.name)
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,172 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,325 questions
{count} votes

Accepted answer
  1. Smaran Thoomu 19,880 Reputation points Microsoft Vendor
    2025-01-29T15:05:31.6566667+00:00

    Hi @SaiSekhar, MahasivaRavi (Philadelphia)
    Welcome to Microsoft Q&A platform and thanks for posting your query here.

    Based on your error, the method mssparkutils.notebook.runMultiple() allows you to run multiple notebooks in parallel or with a predefined topological structure. The API is using a multi-thread implementation mechanism within a spark session, which means the compute resources are shared by the reference notebook runs.I tried to run the mssparkutils.notebook.help("runMultiple") from our end and able to execute without any issues.

    User's image

    Here is the status view of notebook run: Notebook1

    User's image

    Here is the status view of notebook run: Notebook2

    User's image

    In the above example both the notebooks named(Notebook1 and Notebook2) ran using the same Apache spark application named Livy ID 12

    To find the failed notebooks when using the mssparkutils.notebook.runMultiple function, you can inspect the associated snapshots for details on the failures. The error message you received indicates that multiple runs failed, and it suggests checking the snapshots for more information.

    Additionally, you can implement a try-except block around your runMultiple call. In the except block, you can retrieve the results by calling .result on the exception. This will help you gather more information about which specific notebooks encountered issues.

    Here's an example of how you might structure your code:

    try:
        mssparkutils.notebook.runMultiple(DAG)
    except Exception as e:
        print(e.result)  # This will give you details about the failed notebooks
    

    Make sure to handle the exception properly to avoid the AttributeError you encountered, which suggests that you're trying to access a property on a dictionary that doesn't exist.

    For more details, you can refer to Microsoft's official documentation on running parallel notebooks: Azure Databricks Parallel Notebooks Guide

    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.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.