<?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 How to change cluster size using a script in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55610#M30382</link>
    <description>&lt;P&gt;I want to change instance type or number of max workers via a python script. Does anyone know how to do it/is it possible? I have a lot of background jobs when I want to scale down my workers, so autoscaling is not an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was getting an error that node_type_id value must be &lt;SPAN&gt;Standard_DS3_v2 but that is my current one that I want to change&lt;/SPAN&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Failed to update cluster size. Status code: 400, Response: {"error_code":"INVALID_PARAMETER_VALUE","message":"Validation failed for node_type_id, the value must be Standard_DS3_v2 (is \"Standard_DS4_v2\")","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","field_violations":[{"field":"node_type_id","description":"Validation failed for node_type_id, the value must be Standard_DS3_v2 (is \"Standard_DS4_v2\")"}]},{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CM_API_ERROR_SOURCE_CALLER_ERROR","domain":""}]}&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2023 14:45:20 GMT</pubDate>
    <dc:creator>ksenija</dc:creator>
    <dc:date>2023-12-21T14:45:20Z</dc:date>
    <item>
      <title>How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55610#M30382</link>
      <description>&lt;P&gt;I want to change instance type or number of max workers via a python script. Does anyone know how to do it/is it possible? I have a lot of background jobs when I want to scale down my workers, so autoscaling is not an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was getting an error that node_type_id value must be &lt;SPAN&gt;Standard_DS3_v2 but that is my current one that I want to change&lt;/SPAN&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Failed to update cluster size. Status code: 400, Response: {"error_code":"INVALID_PARAMETER_VALUE","message":"Validation failed for node_type_id, the value must be Standard_DS3_v2 (is \"Standard_DS4_v2\")","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","field_violations":[{"field":"node_type_id","description":"Validation failed for node_type_id, the value must be Standard_DS3_v2 (is \"Standard_DS4_v2\")"}]},{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CM_API_ERROR_SOURCE_CALLER_ERROR","domain":""}]}&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 14:45:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55610#M30382</guid>
      <dc:creator>ksenija</dc:creator>
      <dc:date>2023-12-21T14:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55622#M30383</link>
      <description>&lt;P&gt;We can update cluster configuration prgramatically using databricks api.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steps:&lt;/P&gt;&lt;P&gt;&amp;nbsp;1) Fetch all the clusters info present in your workspace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;2) Loop through each cluster info&lt;/P&gt;&lt;P&gt;&amp;nbsp;3)&amp;nbsp;Use the parsed info like cluster id etc.. to update cluster config&lt;/P&gt;&lt;P&gt;Example Psuedo code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import json

host = "https://&amp;lt;YOUR-WORKSPACE-URL&amp;gt;"
workspace_access_token = "&amp;lt;YOUR-ACCESS-TOKEN&amp;gt;"
cluster_id = "&amp;lt;YOUR-CLUSTER-ID&amp;gt;"
workers_min = 1
workers_max = 2

response = requests.post(
        f"{host}/api/2.0/clusters/edit",
        headers={
            "Authorization": f"Bearer {workspace_access_token}",
"Content-Type": "application/json"
        },
        data={
"cluster_id": cluster_id,
"min_workers": workers_min,
"max_workers": workers_max
}
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 19:31:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55622#M30383</guid>
      <dc:creator>RKNutalapati</dc:creator>
      <dc:date>2023-12-21T19:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55634#M30387</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;ksenija, this is just my guess but maybe you are using Cluster Policy in your cluster that only allows you to use specific cluster size ? E.g. below cluster policy that limits to some cluster sizes only.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wojciech_BUK_0-1703200311434.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5655iEE8C7BD80DE963B5/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Wojciech_BUK_0-1703200311434.png" alt="Wojciech_BUK_0-1703200311434.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 23:12:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55634#M30387</guid>
      <dc:creator>Wojciech_BUK</dc:creator>
      <dc:date>2023-12-21T23:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55637#M30390</link>
      <description>&lt;P&gt;Yes, you can only use the node types specified in the policy.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 23:32:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55637#M30390</guid>
      <dc:creator>RKNutalapati</dc:creator>
      <dc:date>2023-12-21T23:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55657#M30398</link>
      <description>&lt;P&gt;You're right, I didn't even check policies. This means I can't even change min and max workers, right?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ksenija_0-1703238074459.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5657i61B16F964B696F43/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="ksenija_0-1703238074459.png" alt="ksenija_0-1703238074459.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 09:41:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55657#M30398</guid>
      <dc:creator>ksenija</dc:creator>
      <dc:date>2023-12-22T09:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to change cluster size using a script</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55661#M30399</link>
      <description>&lt;P&gt;Correct, please look at my example:&lt;BR /&gt;- i have created policy with fixed min and max no. of workers&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wojciech_BUK_0-1703239987614.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5658iD2D7353910EFF861/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Wojciech_BUK_0-1703239987614.png" alt="Wojciech_BUK_0-1703239987614.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Even UI block me and won;t allow to change min and max no. of workers&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wojciech_BUK_1-1703240012156.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5659iBDF20E35C9AD82F8/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Wojciech_BUK_1-1703240012156.png" alt="Wojciech_BUK_1-1703240012156.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So your script will fail as it is violating cluster ploticy&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 10:14:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-cluster-size-using-a-script/m-p/55661#M30399</guid>
      <dc:creator>Wojciech_BUK</dc:creator>
      <dc:date>2023-12-22T10:14:06Z</dc:date>
    </item>
  </channel>
</rss>

