Skip to content

Commit 6920a75

Browse files
authored
Merge pull request Azure#5072 from ro-joowan/job-param
[ADLA] - Adding ScriptParameter parameter and alias
2 parents d1508fe + ff63358 commit 6920a75

35 files changed

+16288
-117106
lines changed

src/ResourceManager/DataLakeAnalytics/ChangeLog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Added a parameter called ScriptParameter to Submit-AzureRmDataLakeAnalyticsJob
22+
- Detailed information about ScriptParameter can be found using Get-Help on Submit-AzureRmDataLakeAnalyticsJob
23+
* For New-AzureRmDataLakeAnalyticsAccount, changed the parameter MaxDegreeOfParallelism to MaxAnalyticsUnits
24+
- Added an alias for the parameter MaxAnalyticsUnits: MaxDegreeOfParallelism
25+
* For New-AzureRmDataLakeAnalyticsComputePolicy, changed the parameter MaxDegreeOfParallelismPerJob to MaxAnalyticsUnitsPerJob
26+
- Added an alias for the parameter MaxAnalyticsUnitsPerJob: MaxDegreeOfParallelismPerJob
27+
* For Set-AzureRmDataLakeAnalyticsAccount, changed the parameter MaxDegreeOfParallelism to MaxAnalyticsUnits
28+
- Added an alias for the parameter MaxAnalyticsUnits: MaxDegreeOfParallelism
29+
* For Submit-AzureRmDataLakeAnalyticsJob, changed the parameter DegreeOfParallelism to AnalyticsUnits
30+
- Added an alias for the parameter AnalyticsUnits: DegreeOfParallelism
31+
* For Update-AzureRmDataLakeAnalyticsComputePolicy, changed the parameter MaxDegreeOfParallelismPerJob to MaxAnalyticsUnitsPerJob
32+
- Added an alias for the parameter MaxAnalyticsUnitsPerJob: MaxDegreeOfParallelismPerJob
2133

2234
## Version 4.0.0
2335
* 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.
@@ -109,4 +121,4 @@
109121
- Better error messaging and support for invalid input
110122
* General help improvements
111123
- Clearer help for job operations
112-
- Fixed typos and incorrect examples
124+
- Fixed typos and incorrect examples

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaAliasTests.ps1

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,14 @@ function Test-DataLakeAnalyticsJob
584584
# Without this, the test will pass non-deterministically
585585
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(300000)
586586

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

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

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

@@ -607,11 +607,46 @@ function Test-DataLakeAnalyticsJob
607607

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

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

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

615+
# Submit a job with script parameters
616+
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest04")
617+
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)
618+
619+
# Define script parameters
620+
$parameters = [ordered]@{}
621+
$parameters["byte_type"] = [byte]0
622+
$parameters["sbyte_type"] = [sbyte]1
623+
$parameters["int_type"] = [int32]2
624+
$parameters["uint_type"] = [uint32]3
625+
$parameters["long_type"] = [int64]4
626+
$parameters["ulong_type"] = [uint64]5
627+
$parameters["float_type"] = [float]6
628+
$parameters["double_type"] = [double]7
629+
$parameters["decimal_type"] = [decimal]8
630+
$parameters["short_type"] = [int16]9
631+
$parameters["ushort_type"] = [uint16]10
632+
$parameters["char_type"] = [char]"a"
633+
$parameters["string_type"] = "test"
634+
$parameters["datetime_type"] = [DateTime](Get-Date -Date "2018-01-01 00:00:00")
635+
$parameters["bool_type"] = $true
636+
$parameters["guid_type"] = [guid]"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d"
637+
$parameters["bytearray_type"] = [byte[]]@(0, 1, 2)
638+
639+
# Define the expected script
640+
$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;"
641+
642+
$jobInfo = Submit-AdlJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;" -ScriptParameter $parameters
643+
Assert-NotNull {$jobInfo}
644+
645+
# Wait for the job to finish and then confirm the script
646+
$jobInfo = Wait-AdlJob -Account $accountName -JobId $jobInfo.JobId
647+
Assert-NotNull {$jobInfo}
648+
Assert-AreEqual $expectedScript $jobInfo.Properties.Script
649+
615650
# Delete the DataLakeAnalytics account
616651
Assert-True {Remove-AdlAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."
617652

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTests.ps1

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,13 @@ function Test-DataLakeAnalyticsJob
471471
# Without this, the test will pass non-deterministically
472472
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(300000)
473473

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

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

@@ -493,11 +493,46 @@ function Test-DataLakeAnalyticsJob
493493

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

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

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

501+
# Submit a job with script parameters
502+
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest03")
503+
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)
504+
505+
# Define script parameters
506+
$parameters = [ordered]@{}
507+
$parameters["byte_type"] = [byte]0
508+
$parameters["sbyte_type"] = [sbyte]1
509+
$parameters["int_type"] = [int32]2
510+
$parameters["uint_type"] = [uint32]3
511+
$parameters["long_type"] = [int64]4
512+
$parameters["ulong_type"] = [uint64]5
513+
$parameters["float_type"] = [float]6
514+
$parameters["double_type"] = [double]7
515+
$parameters["decimal_type"] = [decimal]8
516+
$parameters["short_type"] = [int16]9
517+
$parameters["ushort_type"] = [uint16]10
518+
$parameters["char_type"] = [char]"a"
519+
$parameters["string_type"] = "test"
520+
$parameters["datetime_type"] = [DateTime](Get-Date -Date "2018-01-01 00:00:00")
521+
$parameters["bool_type"] = $true
522+
$parameters["guid_type"] = [guid]"8dbdd1e8-0675-4cf2-a7f7-5e376fa43c6d"
523+
$parameters["bytearray_type"] = [byte[]]@(0, 1, 2)
524+
525+
# Define the expected script
526+
$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;"
527+
528+
$jobInfo = Submit-AdlJob -AccountName $accountName -Name "TestJob" -Script "DROP DATABASE IF EXISTS foo; CREATE DATABASE foo;" -ScriptParameter $parameters
529+
Assert-NotNull {$jobInfo}
530+
531+
# Wait for the job to finish and then confirm the script
532+
$jobInfo = Wait-AdlJob -Account $accountName -JobId $jobInfo.JobId
533+
Assert-NotNull {$jobInfo}
534+
Assert-AreEqual $expectedScript $jobInfo.Properties.Script
535+
501536
# Delete the DataLakeAnalytics account
502537
Assert-True {Remove-AzureRmDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."
503538

0 commit comments

Comments
 (0)