<?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: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105716#M42251</link>
    <description>&lt;P&gt;As per docs, the single task mode has been deprecated, so you will need to use the multi task method as of now&amp;nbsp;&lt;A href="https://docs.databricks.com/api/workspace/jobs/create#format" target="_blank"&gt;https://docs.databricks.com/api/workspace/jobs/create#format&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2025 14:31:59 GMT</pubDate>
    <dc:creator>Walter_C</dc:creator>
    <dc:date>2025-01-15T14:31:59Z</dc:date>
    <item>
      <title>How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/104829#M41897</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am working on deploying a Databricks job to the production environment using a PowerShell script in Azure DevOps release pipeline. The task requires to update the job configuration JSON file to set the job's compute to serverless. For this, I need to set the `existing_cluster_id` field in the job config. Is there a way to programmatically retrieve the dynamic serverless cluster ID so that I can use it to update the `existing_cluster_id` field in the JSON job configuration?&lt;/SPAN&gt;&lt;SPAN&gt;Here's the PowerShell code I am currently working with:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$serverlessId = "xxxx-xxxxxx-xxxxxxxx-xxx"&lt;BR /&gt;$workspaceBasePath = "/path/toWorkspace/"&lt;BR /&gt;$JobPath = "$(ARTIFACT_PATH)\DatabricksBundle\jobs\job-settings.json"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;function Import-Job {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;param (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Mandatory = $true)]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [string]$jsonPath&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (-not (Test-Path $jsonPath)) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output "Error: The job settings file does not exist at the path: $jsonPath"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw "File not found"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   $jsonContent = Get-Content -Path $jsonPath | ConvertFrom-Json&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   $jsonContent.PSObject.Properties.Remove("existing_cluster_id"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   $jsonContent | Add-Member -MemberType NoteProperty -Name "existing_cluster_id" -Value $(serverlessId)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   $jsonPayload = $jsonContent | ConvertTo-Json -Depth 10&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   Write-Output "job-config-settings content: $jsonPayload"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $response = Invoke-RestMethod -Uri "$databricksUrl/api/2.1/jobs/create" -Method Post -Headers $headers -Body $jsonPayload -ContentType "application/json"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output "Job created successfully: $($response.job_id)"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output "Error creating job: $_"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Import-Job -jsonPath $JobPath&lt;BR /&gt;&lt;BR /&gt;Any suggestions or examples on how to get the serverless cluster ID in PowerShell would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 04:27:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/104829#M41897</guid>
      <dc:creator>dunno</dc:creator>
      <dc:date>2025-01-09T04:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/104878#M41916</link>
      <description>&lt;P&gt;Is this field completely required? Based on API job deployment, by not setting any details for cluster on the job the system will set it automatically as Serverless, this as for jobs the serverless will not be the same on each run.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 10:03:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/104878#M41916</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-09T10:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105661#M42230</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you. It worked with multi-task jobs. I was trying with a single task job, and it looks like it requires this id, right? Is there a way to deploy single task jobs in the serverless compute&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 05:58:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105661#M42230</guid>
      <dc:creator>dunno</dc:creator>
      <dc:date>2025-01-15T05:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105716#M42251</link>
      <description>&lt;P&gt;As per docs, the single task mode has been deprecated, so you will need to use the multi task method as of now&amp;nbsp;&lt;A href="https://docs.databricks.com/api/workspace/jobs/create#format" target="_blank"&gt;https://docs.databricks.com/api/workspace/jobs/create#format&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 14:31:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105716#M42251</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-15T14:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105735#M42254</link>
      <description>&lt;P&gt;Got it! Thanks for the info.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 15:32:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105735#M42254</guid>
      <dc:creator>dunno</dc:creator>
      <dc:date>2025-01-15T15:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to Dynamically Retrieve Serverless Cluster ID for Databricks Job Configuration?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105757#M42257</link>
      <description>&lt;P&gt;sure, happy to assist, if any of my responses was able to help you would really appreciate if you can accept it as a solution&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:14:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-dynamically-retrieve-serverless-cluster-id-for-databricks/m-p/105757#M42257</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-15T16:14:58Z</dc:date>
    </item>
  </channel>
</rss>

