Forum Discussion

PyyneCST's avatar
PyyneCST
Frequent Visitor
6 months ago
Solved

Unable to run PySpark Notebook because of apparent Spark Setting issues

Hey,

 

I have a PySpark Notebook that I have been using to develop my data ingestion pipeline. I was able to run it until last week, but today (Monday) when I tried to run it, I am seeing this error:

 

InvalidHttpRequestToLivy: [SparkSettingsMergeValidationError] Settings operation failed due to a validation error: Code = SparkSettingsComputeExceedsPoolLimit, Message = 'The cores or memory you claimed exceeds the limitation of the selected pool, claimed cores: 80, claimed memory: 560, cores limit: 24, memory limit: 168. Please decrease the num of executors or driver/executor size.' . [Root activity id: 5957f569-957c-4ece-9dcd-146ad2612d23] HTTP status code: 400.

 

I have already tried adding the below configuration to the Notebook:

%%configure -f
{
    "executorMemory": "56g",
    "executorCores": 8,
    "driverMemory": "56g",
    "driverCores": 8,
    "numExecutors": 1
}

The values here match my pool settings (medium: 56g, 8 vCore).

 

What could be the problem?

  • Hi,

    Based on the error message, this is not actually a notebook or Livy issue.
    It is a Spark pool resource validation error.

    The error clearly indicates that the Spark session is requesting more compute resources than what your selected Spark pool allows.

    In your case:

    • Claimed cores: 80

    • Claimed memory: 560 GB

    • Pool limit: 24 cores / 168 GB

    So Fabric is rejecting the session creation before execution starts.

    This usually happens when:

    • Executor count × executor cores exceeds pool capacity

    • Driver + executor memory total exceeds pool memory limit

    • Environment or notebook level settings are not aligned with pool node size

    • Dynamic allocation or previous session settings override notebook config

    In Microsoft Fabric, notebook-level Spark configuration must always stay within the boundaries of the selected pool node size and pool scaling limits. Even if you configure executors in the notebook, Fabric will validate them against pool limits during session creation.

    According to Microsoft documentation, session-level compute settings can only be configured within the limits of the selected Spark pool node size and memory boundaries:
    https://learn.microsoft.com/en-us/fabric/data-engineering/environment-manage-compute

    Also, Spark pool node sizes define the available vCores and memory per node, and workloads must fit inside those limits:
    https://learn.microsoft.com/en-us/fabric/data-engineering/create-custom-spark-pools

    Additionally, the %%configure command must be executed at the beginning of the notebook (before session starts), otherwise settings may not apply:
    https://learn.microsoft.com/en-us/fabric/data-engineering/author-execute-notebook


    What I would check step by step

    1️⃣ Validate Pool Configuration

    • Node size (Medium / Large / etc.)

    • Min / Max nodes

    • Autoscale settings

    • Capacity SKU limits

    2️⃣ Validate Notebook Configuration
    Make sure total requested resources are within pool capacity:

    Example:

    Total cores = numExecutors × executorCores + driverCores
    Total memory = numExecutors × executorMemory + driverMemory

    3️⃣ Check Environment vs Notebook Conflicts
    If you have Environment-level Spark settings, they might override notebook config.

    4️⃣ Restart Spark Session
    After changing config, restart session or rerun notebook from first cell.

    5️⃣ Consider Dynamic Allocation
    If workloads vary, enabling dynamic allocation may help optimize executor usage within pool limits.


    Example Safe Configuration (Medium Node Example)

    If pool = Medium (8 vCores / ~56 GB per node):

    %%configure -f
    {
      "executorMemory": "28g",
      "executorCores": 4,
      "driverMemory": "28g",
      "driverCores": 4,
      "numExecutors": 2
    }

    Key Insight

    Fabric Spark works like this:

    Infrastructure Layer → Pool (Nodes / Capacity / SKU)
    Execution Layer → Executors / Driver (must fit inside pool)

    Environment or Notebook configs cannot override pool infrastructure limits.


    If this suddenly started happening (even though notebook worked before), I would also check:

    • Pool configuration changes by admin

    • Capacity SKU changes

    • Environment default compute changes

    • New autoscale limits

    • Concurrent running notebooks consuming pool resources


    Hope this helps.
    Let me know if you can share your pool configuration and capacity SKU — then I can help calculate the safe executor configuration range.

    Best regards

3 Replies

  • PyyneCST's avatar
    PyyneCST
    Frequent Visitor

    Thank you for your answer.

     

    There was an incorrect "Spark executor instances" config in the Environment -- it was set to 1-9. I corrected it and the Notebook runs now.

  • Hi,

    Based on the error message, this is not actually a notebook or Livy issue.
    It is a Spark pool resource validation error.

    The error clearly indicates that the Spark session is requesting more compute resources than what your selected Spark pool allows.

    In your case:

    • Claimed cores: 80

    • Claimed memory: 560 GB

    • Pool limit: 24 cores / 168 GB

    So Fabric is rejecting the session creation before execution starts.

    This usually happens when:

    • Executor count × executor cores exceeds pool capacity

    • Driver + executor memory total exceeds pool memory limit

    • Environment or notebook level settings are not aligned with pool node size

    • Dynamic allocation or previous session settings override notebook config

    In Microsoft Fabric, notebook-level Spark configuration must always stay within the boundaries of the selected pool node size and pool scaling limits. Even if you configure executors in the notebook, Fabric will validate them against pool limits during session creation.

    According to Microsoft documentation, session-level compute settings can only be configured within the limits of the selected Spark pool node size and memory boundaries:
    https://learn.microsoft.com/en-us/fabric/data-engineering/environment-manage-compute

    Also, Spark pool node sizes define the available vCores and memory per node, and workloads must fit inside those limits:
    https://learn.microsoft.com/en-us/fabric/data-engineering/create-custom-spark-pools

    Additionally, the %%configure command must be executed at the beginning of the notebook (before session starts), otherwise settings may not apply:
    https://learn.microsoft.com/en-us/fabric/data-engineering/author-execute-notebook


    What I would check step by step

    1️⃣ Validate Pool Configuration

    • Node size (Medium / Large / etc.)

    • Min / Max nodes

    • Autoscale settings

    • Capacity SKU limits

    2️⃣ Validate Notebook Configuration
    Make sure total requested resources are within pool capacity:

    Example:

    Total cores = numExecutors × executorCores + driverCores
    Total memory = numExecutors × executorMemory + driverMemory

    3️⃣ Check Environment vs Notebook Conflicts
    If you have Environment-level Spark settings, they might override notebook config.

    4️⃣ Restart Spark Session
    After changing config, restart session or rerun notebook from first cell.

    5️⃣ Consider Dynamic Allocation
    If workloads vary, enabling dynamic allocation may help optimize executor usage within pool limits.


    Example Safe Configuration (Medium Node Example)

    If pool = Medium (8 vCores / ~56 GB per node):

    %%configure -f
    {
      "executorMemory": "28g",
      "executorCores": 4,
      "driverMemory": "28g",
      "driverCores": 4,
      "numExecutors": 2
    }

    Key Insight

    Fabric Spark works like this:

    Infrastructure Layer → Pool (Nodes / Capacity / SKU)
    Execution Layer → Executors / Driver (must fit inside pool)

    Environment or Notebook configs cannot override pool infrastructure limits.


    If this suddenly started happening (even though notebook worked before), I would also check:

    • Pool configuration changes by admin

    • Capacity SKU changes

    • Environment default compute changes

    • New autoscale limits

    • Concurrent running notebooks consuming pool resources


    Hope this helps.
    Let me know if you can share your pool configuration and capacity SKU — then I can help calculate the safe executor configuration range.

    Best regards

  • Thankyou, bariscihan for your response.

    Hi PyyneCST,

    We are pleased to note that your issue has been resolved. Thank you for sharing your insights and approach in resolving the issue, which will be beneficial to other members of the community. Should you have any further queries, please feel free to contact the Microsoft Fabric community.

    Thank you.