<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Issue while creating on-demand cluster in azure databricks using pyspark in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103998#M41627</link>
    <description>&lt;P&gt;Thankyou &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/34618"&gt;@VZLA&lt;/a&gt;&amp;nbsp;for the detailed email.&lt;BR /&gt;I tried to run using the configuration you suggested for single node but got the same error. I tried with different configurations but all giving the same error. Even a simple configuration like this is also failing with same error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;clusterConfig={
    "new_cluster": {
        "spark_version": "15.4.x-scala2.12",
        "effective_spark_version": "15.4.x-cpu-ml-scala2.12",
        "node_type_id": "Standard_D14_v2",
        "azure_attributes": {
            "availability": "ON_DEMAND_AZURE"
        },
        "autoscale": {
            "min_workers": 5,
            "max_workers": 15
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jan 2025 19:42:25 GMT</pubDate>
    <dc:creator>vivek_cloudde</dc:creator>
    <dc:date>2025-01-02T19:42:25Z</dc:date>
    <item>
      <title>Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103852#M41575</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I am trying to create an on demand cluster in azure databricks using below code and i am getting the error message&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;SPAN&gt;{"error_code":"INVALID_PARAMETER_VALUE","message":"Exactly 1 of virtual_cluster_size, num_workers or autoscale must be specified.","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CM_API_ERROR_SOURCE_CALLER_ERROR","domain":""}]}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;I tried different settings multiple times and still getting the same error every time. Can someone please help me resolve this issue? As per my understanding it is not possible to create ondemand cluster with auto scale capabilities. Can someone please confirm if my understanding is correct?&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import json

clusterConfig={
"new_cluster": {
        "spark_version": "15.4.x-scala2.12",
        "effective_spark_version": "15.4.x-cpu-ml-scala2.12",
        "node_type_id": "Standard_D14_v2",
        "spark_conf": {
            "spark.databricks.delta.preview.enabled": True
        },
        "custom_tags": {
            "ResourceClass": "SingleNode"
        },
        "azure_attributes": {
            "first_on_demand": 1,
            "availability": "ON_DEMAND_AZURE",
            "spot_bid_max_price": "-1"
        },
        "enable_elastic_disk": True,
        "num_workers": 2,
        "autotermination_minutes": 10
    }
}

# Initialize the DatabricksAPI with your workspace URL and token
workspaceUrl = "https://###########.azuredatabricks.net"
databricksToken = dbutils.secrets.get(scope="##############", key="dbx-token")

# Headers for the API request
headers = {
    "Authorization": f"Bearer {databricksToken}",
    "Content-Type": "application/json"
}

try:
  # Send the API request to create the cluster
  response = requests.post(
      f"{workspaceUrl}/api/2.0/clusters/create",
      headers=headers,
      data=json.dumps(clusterConfig)
  )

  if response.status_code == 200:
    # Extract the cluster_id from the response
    cluster_data = response.json()
    cluster_id = cluster_data["cluster_id"]
    print(f"Cluster created successfully! Cluster ID: {cluster_id}")
  else:
    print(f"Error creating cluster: {response.status_code}, {response.text}")
except Exception as e:
  print("ErrorMessage:" + str(e))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 02:19:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103852#M41575</guid>
      <dc:creator>vivek_cloudde</dc:creator>
      <dc:date>2025-01-02T02:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103903#M41598</link>
      <description>&lt;P&gt;You cannot specify both &lt;CODE&gt;num_workers&lt;/CODE&gt; and &lt;CODE&gt;autoscale&lt;/CODE&gt; simultaneously.&amp;nbsp;To resolve the issue, you should remove the &lt;CODE&gt;autoscale&lt;/CODE&gt; parameter if you want to use a fixed number of workers.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 12:08:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103903#M41598</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-02T12:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103991#M41625</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/139672"&gt;@vivek_cloudde&lt;/a&gt;&amp;nbsp;thanks for your question!&lt;/P&gt;
&lt;P&gt;You can absolutely create an on-demand cluster with auto-scaling on Azure—it’s not blocked. You just need to remove any conflicting parameters so the API sees only one setting for worker configuration.&lt;/P&gt;
&lt;P&gt;You’re hitting the error because Databricks expects exactly one of these in your cluster config:&amp;nbsp;num_workers, &lt;STRONG&gt;or&lt;/STRONG&gt;&lt;BR /&gt;autoscale, &lt;STRONG&gt;or&lt;/STRONG&gt;&amp;nbsp;virtual_cluster_size (&lt;EM&gt;rarely used&lt;/EM&gt;). So, you can have an on-demand cluster ("availability": "ON_DEMAND_AZURE") with autoscaling by specifying:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"autoscale": {
  "min_workers": 2,
  "max_workers": 8
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although in this case, the error message could be confusing. Now, coming back to your JSON file, nothing in this snippet explicitly sets autoscale or min_workers field, it only has "num_workers": 2, so the error suggests something else is adding or conflicting with autoscale / virtual_cluster_size. Is this the actual JSON going to the API endpoint?&lt;/P&gt;
&lt;P&gt;The only unusual thing I can spot on this JSON, is that you have "SingleNode" in custom_tags, but you're also specifying num_workers. I'm not very confident this would work, a SingleNode, usually doesn't have workers? or num_workers would be 0 ? But probably even setting num_workers regardless of its value the assertion would still fail to validate? Please try removing num_workers first.&lt;/P&gt;
&lt;P&gt;Can you please try with the following, or something simpler, and start building it up while fixing the issues along the way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;clusterConfig={
    "new_cluster": {
        "spark_version": "15.4.x-scala2.12",
        "node_type_id": "Standard_D14_v2",
        "spark_conf": {
            "spark.databricks.cluster.profile": "singleNode",
            "spark.master": "local[*]",
            "spark.databricks.delta.preview.enabled": true
        },
        "custom_tags": {
            "ResourceClass": "SingleNode"
        },
        "azure_attributes": {
            "first_on_demand": 1,
            "availability": "ON_DEMAND_AZURE",
            "spot_bid_max_price": "-1"
        },
        "enable_elastic_disk": true,
        "num_workers": 0,
        "autotermination_minutes": 10
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 18:10:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103991#M41625</guid>
      <dc:creator>VZLA</dc:creator>
      <dc:date>2025-01-02T18:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103998#M41627</link>
      <description>&lt;P&gt;Thankyou &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/34618"&gt;@VZLA&lt;/a&gt;&amp;nbsp;for the detailed email.&lt;BR /&gt;I tried to run using the configuration you suggested for single node but got the same error. I tried with different configurations but all giving the same error. Even a simple configuration like this is also failing with same error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;clusterConfig={
    "new_cluster": {
        "spark_version": "15.4.x-scala2.12",
        "effective_spark_version": "15.4.x-cpu-ml-scala2.12",
        "node_type_id": "Standard_D14_v2",
        "azure_attributes": {
            "availability": "ON_DEMAND_AZURE"
        },
        "autoscale": {
            "min_workers": 5,
            "max_workers": 15
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 19:42:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103998#M41627</guid>
      <dc:creator>vivek_cloudde</dc:creator>
      <dc:date>2025-01-02T19:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103999#M41628</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/88823"&gt;@Walter_C&lt;/a&gt;&amp;nbsp;for the reply. I tried what you suggested already and it is failing with same issue.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 19:44:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/103999#M41628</guid>
      <dc:creator>vivek_cloudde</dc:creator>
      <dc:date>2025-01-02T19:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104001#M41630</link>
      <description>&lt;P&gt;Can you try with the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;clusterConfig = {
  "cluster_name": "cluster-name",
  "spark_version": "14.3.x-scala2.12",
  "node_type_id": "Standard_D14_v2",
  "azure_attributes": {
    "availability": "ON_DEMAND_AZURE"
  },
  "autoscale": {
    "min_workers": 5,
    "max_workers": 15
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tested internally and worked for me, seems that you are using the job cluster creation mechanism to create an all purpose cluster.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 20:52:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104001#M41630</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-02T20:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104004#M41632</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/88823"&gt;@Walter_C&lt;/a&gt;&amp;nbsp;it worked.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 21:55:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104004#M41632</guid>
      <dc:creator>vivek_cloudde</dc:creator>
      <dc:date>2025-01-02T21:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104011#M41635</link>
      <description>&lt;P&gt;Glad to hear it worked&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 00:39:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104011#M41635</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-03T00:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while creating on-demand cluster in azure databricks using pyspark</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104050#M41650</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/139672"&gt;@vivek_cloudde&lt;/a&gt;&amp;nbsp;I still find it interesting to know that for all these different misconfigurations or wrong cluster definitions, you got the same error message, but anyways, happy to hear it worked !&lt;/P&gt;
&lt;P&gt;If it helps, next time and to make things simpler, you may attempt once&amp;nbsp;&lt;SPAN&gt;filling out the&amp;nbsp;&lt;/SPAN&gt;&lt;A class="du-bois-light-typography css-cs8bxj" href="https://docs.databricks.com/compute/configure.html" target="_blank" rel="noopener noreferrer"&gt;create compute UI&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;and then copying the generated JSON definition from the UI.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 10:36:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-while-creating-on-demand-cluster-in-azure-databricks-using/m-p/104050#M41650</guid>
      <dc:creator>VZLA</dc:creator>
      <dc:date>2025-01-03T10:36:04Z</dc:date>
    </item>
  </channel>
</rss>

