Skip to content

[ADLA] - Adding ScriptParameter parameter and alias #5072

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 22 commits into from
Dec 8, 2017
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
14 changes: 13 additions & 1 deletion src/ResourceManager/DataLakeAnalytics/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
- Additional information about change #1
-->
## Current Release
* Added a parameter called ScriptParameter to Submit-AzureRmDataLakeAnalyticsJob
- Detailed information about ScriptParameter can be found using Get-Help on Submit-AzureRmDataLakeAnalyticsJob
* For New-AzureRmDataLakeAnalyticsAccount, changed the parameter MaxDegreeOfParallelism to MaxAnalyticsUnits
- Added an alias for the parameter MaxAnalyticsUnits: MaxDegreeOfParallelism
* For New-AzureRmDataLakeAnalyticsComputePolicy, changed the parameter MaxDegreeOfParallelismPerJob to MaxAnalyticsUnitsPerJob
- Added an alias for the parameter MaxAnalyticsUnitsPerJob: MaxDegreeOfParallelismPerJob
* For Set-AzureRmDataLakeAnalyticsAccount, changed the parameter MaxDegreeOfParallelism to MaxAnalyticsUnits
- Added an alias for the parameter MaxAnalyticsUnits: MaxDegreeOfParallelism
* For Submit-AzureRmDataLakeAnalyticsJob, changed the parameter DegreeOfParallelism to AnalyticsUnits
- Added an alias for the parameter AnalyticsUnits: DegreeOfParallelism
* For Update-AzureRmDataLakeAnalyticsComputePolicy, changed the parameter MaxDegreeOfParallelismPerJob to MaxAnalyticsUnitsPerJob
- Added an alias for the parameter MaxAnalyticsUnitsPerJob: MaxDegreeOfParallelismPerJob

## Version 4.0.0
* NOTE: This is a breaking change release. Please see the migration guide (https://aka.ms/azps-migration-guide) for a full list of breaking changes introduced.
Expand Down Expand Up @@ -109,4 +121,4 @@
- Better error messaging and support for invalid input
* General help improvements
- Clearer help for job operations
- Fixed typos and incorrect examples
- Fixed typos and incorrect examples
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,14 @@ function Test-DataLakeAnalyticsJob
# Without this, the test will pass non-deterministically
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(300000)

# submit a job
# Submit a job
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest02")
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)

$jobInfo = Submit-AdlJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;"
Assert-NotNull {$jobInfo}

# "cancel" the fake job right away
# "Cancel" the fake job right away
Stop-AdlJob -AccountName $accountName -JobId $jobInfo.JobId -Force
$cancelledJob = Get-AdlJob -AccountName $accountName -JobId $jobInfo.JobId

Expand All @@ -607,11 +607,46 @@ function Test-DataLakeAnalyticsJob

Assert-True {$jobsWithDateOffset.Count -gt 0} "Failed to retrieve jobs submitted after ten miuntes ago"

# we add ten minutes to ensure that the timing is right, since we are using the account creation time, and not truly "now"
# We add ten minutes to ensure that the timing is right, since we are using the account creation time, and not truly "now"
$jobsWithDateOffset = Get-AdlJob -AccountName $accountName -SubmittedBefore $([DateTimeOffset]($nowTime).AddMinutes(10))

Assert-True {$jobsWithDateOffset.Count -gt 0} "Failed to retrieve jobs submitted before right now"

# Submit a job with script parameters
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest04")
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)

# Define script parameters
$parameters = [ordered]@{}
$parameters["byte_type"] = [byte]0
$parameters["sbyte_type"] = [sbyte]1
$parameters["int_type"] = [int32]2
$parameters["uint_type"] = [uint32]3
$parameters["long_type"] = [int64]4
$parameters["ulong_type"] = [uint64]5
$parameters["float_type"] = [float]6
$parameters["double_type"] = [double]7
$parameters["decimal_type"] = [decimal]8
$parameters["short_type"] = [int16]9
$parameters["ushort_type"] = [uint16]10
$parameters["char_type"] = [char]"a"
$parameters["string_type"] = "test"
$parameters["datetime_type"] = [DateTime](Get-Date -Date "2018-01-01 00:00:00")
$parameters["bool_type"] = $true
$parameters["guid_type"] = [guid]"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d"
$parameters["bytearray_type"] = [byte[]]@(0, 1, 2)

# Define the expected script
$expectedScript = "DECLARE @byte_type byte = 0;`nDECLARE @sbyte_type sbyte = 1;`nDECLARE @int_type int = 2;`nDECLARE @uint_type uint = 3;`nDECLARE @long_type long = 4;`nDECLARE @ulong_type ulong = 5;`nDECLARE @float_type float = 6;`nDECLARE @double_type double = 7;`nDECLARE @decimal_type decimal = 8;`nDECLARE @short_type short = 9;`nDECLARE @ushort_type ushort = 10;`nDECLARE @char_type char = 'a';`nDECLARE @string_type string = `"test`";`nDECLARE @datetime_type DateTime = new DateTime(2018, 1, 1, 0, 0, 0, 0);`nDECLARE @bool_type bool = true;`nDECLARE @guid_type Guid = new Guid(`"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d`");`nDECLARE @bytearray_type byte[] = new byte[] {`n 0,`n 1,`n 2,`n};`nDROP DATABASE IF EXISTS foo; CREATE DATABASE foo;"

$jobInfo = Submit-AdlJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;" -ScriptParameter $parameters
Assert-NotNull {$jobInfo}

# Wait for the job to finish and then confirm the script
$jobInfo = Wait-AdlJob -Account $accountName -JobId $jobInfo.JobId
Assert-NotNull {$jobInfo}
Assert-AreEqual $expectedScript $jobInfo.Properties.Script

# Delete the DataLakeAnalytics account
Assert-True {Remove-AdlAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,13 @@ function Test-DataLakeAnalyticsJob
# Without this, the test will pass non-deterministically
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(300000)

# submit a job
# Submit a job
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest01")
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)
$jobInfo = Submit-AzureRmDataLakeAnalyticsJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;"
Assert-NotNull {$jobInfo}

# "cancel" the fake job right away
# "Cancel" the fake job right away
Stop-AzureRmDataLakeAnalyticsJob -AccountName $accountName -JobId $jobInfo.JobId -Force
$cancelledJob = Get-AzureRmDataLakeAnalyticsJob -AccountName $accountName -JobId $jobInfo.JobId

Expand All @@ -493,11 +493,46 @@ function Test-DataLakeAnalyticsJob

Assert-True {$jobsWithDateOffset.Count -gt 0} "Failed to retrieve jobs submitted after ten miuntes ago"

# we add ten minutes to ensure that the timing is right, since we are using the account creation time, and not truly "now"
# We add ten minutes to ensure that the timing is right, since we are using the account creation time, and not truly "now"
$jobsWithDateOffset = Get-AzureRmDataLakeAnalyticsJob -AccountName $accountName -SubmittedBefore $([DateTimeOffset]($nowTime).AddMinutes(10))

Assert-True {$jobsWithDateOffset.Count -gt 0} "Failed to retrieve jobs submitted before right now"

# Submit a job with script parameters
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest03")
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)

# Define script parameters
$parameters = [ordered]@{}
$parameters["byte_type"] = [byte]0
$parameters["sbyte_type"] = [sbyte]1
$parameters["int_type"] = [int32]2
$parameters["uint_type"] = [uint32]3
$parameters["long_type"] = [int64]4
$parameters["ulong_type"] = [uint64]5
$parameters["float_type"] = [float]6
$parameters["double_type"] = [double]7
$parameters["decimal_type"] = [decimal]8
$parameters["short_type"] = [int16]9
$parameters["ushort_type"] = [uint16]10
$parameters["char_type"] = [char]"a"
$parameters["string_type"] = "test"
$parameters["datetime_type"] = [DateTime](Get-Date -Date "2018-01-01 00:00:00")
$parameters["bool_type"] = $true
$parameters["guid_type"] = [guid]"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d"
$parameters["bytearray_type"] = [byte[]]@(0, 1, 2)

# Define the expected script
$expectedScript = "DECLARE @byte_type byte = 0;`nDECLARE @sbyte_type sbyte = 1;`nDECLARE @int_type int = 2;`nDECLARE @uint_type uint = 3;`nDECLARE @long_type long = 4;`nDECLARE @ulong_type ulong = 5;`nDECLARE @float_type float = 6;`nDECLARE @double_type double = 7;`nDECLARE @decimal_type decimal = 8;`nDECLARE @short_type short = 9;`nDECLARE @ushort_type ushort = 10;`nDECLARE @char_type char = 'a';`nDECLARE @string_type string = `"test`";`nDECLARE @datetime_type DateTime = new DateTime(2018, 1, 1, 0, 0, 0, 0);`nDECLARE @bool_type bool = true;`nDECLARE @guid_type Guid = new Guid(`"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d`");`nDECLARE @bytearray_type byte[] = new byte[] {`n 0,`n 1,`n 2,`n};`nDROP DATABASE IF EXISTS foo; CREATE DATABASE foo;"

$jobInfo = Submit-AdlJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;" -ScriptParameter $parameters
Assert-NotNull {$jobInfo}

# Wait for the job to finish and then confirm the script
$jobInfo = Wait-AdlJob -Account $accountName -JobId $jobInfo.JobId
Assert-NotNull {$jobInfo}
Assert-AreEqual $expectedScript $jobInfo.Properties.Script

# Delete the DataLakeAnalytics account
Assert-True {Remove-AzureRmDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."

Expand Down
Loading