SingleScripts/Create-Job.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$true,Position=1)] [string] $DBAPIRootUrl, [Parameter(Mandatory=$True,Position=2)] [string] $DBAPIKey, [Parameter(Mandatory=$True,Position=3)] [string] $JobName, [Parameter(Mandatory=$True,Position=4)] [string] $NotebookPath, [Parameter(Mandatory=$False,Position=5)] [string] $NumberWorkers = 4 ) $headers = @{ Authorization = "Bearer $DBAPIKey" "Content-Type" = "application/json" } $JobAPICreateUrl = $DBAPIRootUrl.Trim('/') + "/api/2.0/jobs/create" $notebook_params = @{ "dry-run"= $true} $clusterconf = @{ "spark_version"= '4.0.x-scala2.11'; "node_type_id" = 'Standard_DS3_v2'; "num_workers"= $NumberWorkers } $timeoutseconds = 3600 $maxretries = 1 $notebooktask = @{"notebook_path" = $NotebookPath} $jobbodyJson = @{ name = $setupjobname new_cluster = $clusterconf timeout_seconds = $timeoutseconds max_retries = $maxretries notebook_task = $notebooktask } | ConvertTo-Json $result = Invoke-RestMethod -Uri $JobAPICreateUrl -Method POST -Headers $headers -Body $jobbodyJson $result |