Skip to content

[Synapse] Support for setting spark pool configuration by artifact #20024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Synapse/Synapse/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->

## Upcoming Release
* Added breaking change message for `-SparkConfigFilePath`. It will be deprecated around the middle of December.
* Updated `New-AzSynapseSparkPool` and `Update-AzSynapseSparkPool` to support for setting spark pool configuration artifact by `-SparkCongifuration`. `-SparkCongifuration` is an alternative of parameter `-SparkConfigFilePath`.

## Version 2.1.0
* Updated `Update-AzSynaspeWorkSpace` and `New-AzSynpaseWorkspace` to support for Workspace Encrytion Managed Identity setting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
using Microsoft.Azure.Commands.Synapse.Properties;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.Synapse.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;
using System.Collections;
using System.IO;
using System.Management.Automation;
Expand Down Expand Up @@ -126,11 +126,16 @@ public class NewAzureSynapseSparkPool : SynapseManagementCmdletBase
[ValidateNotNullOrEmpty]
public string SparkVersion { get; set; }

[CmdletParameterBreakingChange("SparkConfigFilePath", ReplaceMentCmdletParameterName = "SparkConfiguration")]
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false,
HelpMessage = HelpMessages.SparkConfigPropertiesFilePath)]
[ValidateNotNullOrEmpty]
public string SparkConfigFilePath { get; set; }

[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false,
HelpMessage = HelpMessages.SparkConfigurationResource)]
public PSSparkConfigurationResource SparkConfiguration { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

Expand Down Expand Up @@ -197,6 +202,19 @@ public override void ExecuteCmdlet()
};
}

if (this.IsParameterBound(c => c.SparkConfiguration))
{
if (this.SparkConfiguration != null)
{
sparkConfigProperties = new SparkConfigProperties()
{
Filename = SparkConfiguration.Name,
ConfigurationType = ConfigurationType.Artifact,
Content = Newtonsoft.Json.JsonConvert.SerializeObject(SparkConfiguration)
};
}
}

var createParams = new BigDataPoolResourceInfo
{
Location = existingWorkspace.Location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Microsoft.Azure.Commands.Synapse.Properties;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.Synapse.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;
using System.Collections;
Expand Down Expand Up @@ -138,10 +139,15 @@ public class UpdateAzureSynapseSparkPool : SynapseManagementCmdletBase
HelpMessage = HelpMessages.LibraryRequirementsFilePath)]
public string LibraryRequirementsFilePath { get; set; }

[CmdletParameterBreakingChange("SparkConfigFilePath", ReplaceMentCmdletParameterName = "SparkConfiguration")]
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false,
HelpMessage = HelpMessages.SparkConfigPropertiesFilePath)]
public string SparkConfigFilePath { get; set; }

[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false,
HelpMessage = HelpMessages.SparkConfigurationResource)]
public PSSparkConfigurationResource SparkConfiguration { get; set; }

[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false,
HelpMessage = HelpMessages.PackageAction)]
public SynapseConstants.PackageActionType PackageAction { get; set; }
Expand Down Expand Up @@ -278,6 +284,21 @@ public override void ExecuteCmdlet()
}
}

if (this.IsParameterBound(c => c.SparkConfiguration))
{
if (this.SparkConfiguration != null)
{
existingSparkPool.SparkConfigProperties = new SparkConfigProperties()
{
Filename = SparkConfiguration.Name,
ConfigurationType = ConfigurationType.Artifact,
Content = Newtonsoft.Json.JsonConvert.SerializeObject(SparkConfiguration)
};
}
else
existingSparkPool.SparkConfigProperties = null;
}

bool? isForceApplySetting = false;
if (ForceApplySetting.IsPresent)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Synapse/Synapse/Common/HelpMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public static class HelpMessages

public const string LibraryRequirementsFilePath = "Environment configuration file (\"PIP freeze\" output).";

public const string SparkConfigPropertiesFilePath = "Spark pool properties configuration file.";
public const string SparkConfigPropertiesFilePath = "[Deprecated] Spark pool properties configuration file. This parameter is deprecated, please use \"-SparkConfiguration\" instead.";

public const string SparkConfigurationResource = "Apache Spark configuration. When a job is submitted to the pool, the properties specified in the selected configuration will be referenced.";

public const string Batch = "Indicates Spark batch.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Azure.Analytics.Synapse.Artifacts.Models;
using Newtonsoft.Json;

namespace Microsoft.Azure.Commands.Synapse.Models
{
Expand All @@ -27,9 +28,10 @@ public PSSparkConfigurationResource(SparkConfigurationResource sparkConfiguratio
this.WorkspaceName = workspaceName;
this.Properties = sparkConfiguration?.Properties != null? new PSSparkConfiguration(sparkConfiguration.Properties) : null;
}

public string WorkspaceName { get; set; }

[JsonProperty(PropertyName = "properties")]
public PSSparkConfiguration Properties { get; set; }
}
}
40 changes: 29 additions & 11 deletions src/Synapse/Synapse/help/New-AzSynapseSparkPool.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,37 @@ Creates a Synapse Analytics Spark pool.
New-AzSynapseSparkPool [-ResourceGroupName <String>] -WorkspaceName <String> -Name <String> [-Tag <Hashtable>]
-NodeSize <String> -AutoScaleMinNodeCount <Int32> -AutoScaleMaxNodeCount <Int32> [-EnableAutoPause]
[-AutoPauseDelayInMinute <Int32>] [-EnableDynamicExecutorAllocation] [-MinExecutorCount <Int32>]
[-MaxExecutorCount <Int32>] -SparkVersion <String> [-SparkConfigFilePath <String>] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-MaxExecutorCount <Int32>] -SparkVersion <String> [-SparkConfigFilePath <String>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### CreateByNameAndDisableAutoScaleParameterSet
```
New-AzSynapseSparkPool [-ResourceGroupName <String>] -WorkspaceName <String> -Name <String> [-Tag <Hashtable>]
-NodeCount <Int32> -NodeSize <String> [-EnableAutoPause] [-AutoPauseDelayInMinute <Int32>]
[-EnableDynamicExecutorAllocation] [-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>]
-SparkVersion <String> [-SparkConfigFilePath <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
-SparkVersion <String> [-SparkConfigFilePath <String>] [-SparkConfiguration <PSSparkConfigurationResource>]
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### CreateByParentObjectAndEnableAutoScaleParameterSet
```
New-AzSynapseSparkPool -WorkspaceObject <PSSynapseWorkspace> -Name <String> [-Tag <Hashtable>]
-NodeSize <String> -AutoScaleMinNodeCount <Int32> -AutoScaleMaxNodeCount <Int32> [-EnableAutoPause]
[-AutoPauseDelayInMinute <Int32>] [-EnableDynamicExecutorAllocation] [-MinExecutorCount <Int32>]
[-MaxExecutorCount <Int32>] -SparkVersion <String> [-SparkConfigFilePath <String>] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-MaxExecutorCount <Int32>] -SparkVersion <String> [-SparkConfigFilePath <String>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### CreateByParentObjectAndDisableAutoScaleParameterSet
```
New-AzSynapseSparkPool -WorkspaceObject <PSSynapseWorkspace> -Name <String> [-Tag <Hashtable>]
-NodeCount <Int32> -NodeSize <String> [-EnableAutoPause] [-AutoPauseDelayInMinute <Int32>]
[-EnableDynamicExecutorAllocation] [-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>]
-SparkVersion <String> [-SparkConfigFilePath <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
-SparkVersion <String> [-SparkConfigFilePath <String>] [-SparkConfiguration <PSSparkConfigurationResource>]
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -76,10 +78,11 @@ This command creates an Azure Synapse Analytics Spark pool with dynamic executor

### Example 4
```powershell
New-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -NodeCount 3 -SparkVersion 2.4 -NodeSize Small -SparkConfigFilePath "c:\sparkproperties.txt"
$config = Get-AzSynapseSparkConfiguration -WorkspaceName ContosoWorkspace -Name ContosoSparkConfig1
New-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -NodeCount 3 -SparkVersion 2.4 -NodeSize Small -SparkConfiguration $config
```

This command creates an Azure Synapse Analytics Spark pool and upload a spark configuration file.
This command creates an Azure Synapse Analytics Spark pool and specify a Spark configuration for Spark pool.

### Example 5
```powershell
Expand Down Expand Up @@ -299,7 +302,7 @@ Accept wildcard characters: False
```

### -SparkConfigFilePath
Spark pool properties configuration file.
[Deprecated] Spark pool properties configuration file. This parameter is deprecated, please use "-SparkConfiguration" instead.

```yaml
Type: System.String
Expand All @@ -313,6 +316,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -SparkConfiguration
Apache Spark configuration. When a job is submitted to the pool, the properties specified in the selected configuration will be referenced.

```yaml
Type: Microsoft.Azure.Commands.Synapse.Models.PSSparkConfigurationResource
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SparkVersion
Apache Spark version.
Allowed values: 2.4
Expand Down
31 changes: 24 additions & 7 deletions src/Synapse/Synapse/help/Update-AzSynapseSparkPool.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Update-AzSynapseSparkPool [-ResourceGroupName <String>] -WorkspaceName <String>
[-AutoScaleMaxNodeCount <Int32>] [-EnableAutoPause <Boolean>] [-AutoPauseDelayInMinute <Int32>]
[-NodeCount <Int32>] [-NodeSize <String>] [-EnableDynamicExecutorAllocation <Boolean>]
[-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>] [-SparkVersion <String>]
[-LibraryRequirementsFilePath <String>] [-SparkConfigFilePath <String>] [-PackageAction <PackageActionType>]
[-LibraryRequirementsFilePath <String>] [-SparkConfigFilePath <String>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-PackageAction <PackageActionType>]
[-Package <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Synapse.Models.WorkspacePackages.PSSynapseWorkspacePackage]>]
[-ForceApplySetting] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand All @@ -32,7 +33,7 @@ Update-AzSynapseSparkPool -Name <String> -WorkspaceObject <PSSynapseWorkspace> [
[-EnableAutoPause <Boolean>] [-AutoPauseDelayInMinute <Int32>] [-NodeCount <Int32>] [-NodeSize <String>]
[-EnableDynamicExecutorAllocation <Boolean>] [-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>]
[-SparkVersion <String>] [-LibraryRequirementsFilePath <String>] [-SparkConfigFilePath <String>]
[-PackageAction <PackageActionType>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-PackageAction <PackageActionType>]
[-Package <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Synapse.Models.WorkspacePackages.PSSynapseWorkspacePackage]>]
[-ForceApplySetting] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand All @@ -45,7 +46,7 @@ Update-AzSynapseSparkPool -InputObject <PSSynapseSparkPool> [-Tag <Hashtable>] [
[-AutoPauseDelayInMinute <Int32>] [-NodeCount <Int32>] [-NodeSize <String>]
[-EnableDynamicExecutorAllocation <Boolean>] [-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>]
[-SparkVersion <String>] [-LibraryRequirementsFilePath <String>] [-SparkConfigFilePath <String>]
[-PackageAction <PackageActionType>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-PackageAction <PackageActionType>]
[-Package <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Synapse.Models.WorkspacePackages.PSSynapseWorkspacePackage]>]
[-ForceApplySetting] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand All @@ -58,7 +59,7 @@ Update-AzSynapseSparkPool -ResourceId <String> [-Tag <Hashtable>] [-EnableAutoSc
[-AutoPauseDelayInMinute <Int32>] [-NodeCount <Int32>] [-NodeSize <String>]
[-EnableDynamicExecutorAllocation <Boolean>] [-MinExecutorCount <Int32>] [-MaxExecutorCount <Int32>]
[-SparkVersion <String>] [-LibraryRequirementsFilePath <String>] [-SparkConfigFilePath <String>]
[-PackageAction <PackageActionType>]
[-SparkConfiguration <PSSparkConfigurationResource>] [-PackageAction <PackageActionType>]
[-Package <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Synapse.Models.WorkspacePackages.PSSynapseWorkspacePackage]>]
[-ForceApplySetting] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand Down Expand Up @@ -167,10 +168,11 @@ The first command retrieves an Apache Spark pool in Azure Synapse Analytics. The

### Example 14
```powershell
Update-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -Tag @{"key" = "value"} -NodeCount 5 -NodeSize Medium -SparkConfigFilePath "c:\sparkconfig.txt"
$config = Get-AzSynapseSparkConfiguration -WorkspaceName ContosoWorkspace -Name ContosoSparkConfig1
Update-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -Tag @{"key" = "value"} -NodeCount 5 -NodeSize Medium -SparkConfiguration $configs
```

This command updates an Apache Spark pool in Azure Synapse Analytics and upload a spark configuration file for the spark pool.
This command updates an Apache Spark pool in Azure Synapse Analytics and specify a Spark configuration for the Spark pool.

### Example 15
```powershell
Expand Down Expand Up @@ -495,7 +497,7 @@ Accept wildcard characters: False
```

### -SparkConfigFilePath
Spark pool properties configuration file.
[Deprecated] Spark pool properties configuration file. This parameter is deprecated, please use "-SparkConfiguration" instead.

```yaml
Type: System.String
Expand All @@ -509,6 +511,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -SparkConfiguration
Apache Spark configuration. When a job is submitted to the pool, the properties specified in the selected configuration will be referenced.

```yaml
Type: Microsoft.Azure.Commands.Synapse.Models.PSSparkConfigurationResource
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SparkVersion
Apache Spark version.
Allowed values: 2.3,2.4,3.1,3.2
Expand Down