Skip to content

Commit 1523701

Browse files
author
jasper-schneider
committed
Add autoscale eval parameter for New-AzureBatchPool
1 parent 729df43 commit 1523701

File tree

8 files changed

+98
-66
lines changed

8 files changed

+98
-66
lines changed

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/PoolTests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function Test-NewPool
4747
# Create a complicated pool using AutoScale parameter set
4848
$maxTasksPerComputeNode = 2
4949
$autoScaleFormula = '$TargetDedicated=2'
50+
$evalInterval = [TimeSpan]::FromMinutes(7)
5051

5152
$startTask = New-Object Microsoft.Azure.Commands.Batch.Models.PSStartTask
5253
$startTaskCmd = "cmd /c dir /s"
@@ -69,7 +70,7 @@ function Test-NewPool
6970

7071
$displayName = "displayName"
7172

72-
New-AzureBatchPool -Id $poolId2 -VirtualMachineSize $vmSize -OSFamily $osFamily -TargetOSVersion $targetOSVersion -DisplayName $displayName -MaxTasksPerComputeNode $maxTasksPerComputeNode -AutoScaleFormula $autoScaleFormula -StartTask $startTask -TaskSchedulingPolicy $schedulingPolicy -InterComputeNodeCommunicationEnabled -Metadata $metadata -BatchContext $context
73+
New-AzureBatchPool -Id $poolId2 -VirtualMachineSize $vmSize -OSFamily $osFamily -TargetOSVersion $targetOSVersion -DisplayName $displayName -MaxTasksPerComputeNode $maxTasksPerComputeNode -AutoScaleFormula $autoScaleFormula -AutoScaleEvaluationInterval $evalInterval -StartTask $startTask -TaskSchedulingPolicy $schedulingPolicy -InterComputeNodeCommunicationEnabled -Metadata $metadata -BatchContext $context
7374

7475
$pool2 = Get-AzureBatchPool -Id $poolId2 -BatchContext $context
7576

@@ -82,6 +83,7 @@ function Test-NewPool
8283
Assert-AreEqual $maxTasksPerComputeNOde $pool2.MaxTasksPerComputeNode
8384
Assert-AreEqual $true $pool2.AutoScaleEnabled
8485
Assert-AreEqual $autoScaleFormula $pool2.AutoScaleFormula
86+
Assert-AreEqual $evalInterval $pool2.AutoScaleEvaluationInterval
8587
Assert-AreEqual $true $pool2.InterComputeNodeCommunicationEnabled
8688
Assert-AreEqual $startTaskCmd $pool2.StartTask.CommandLine
8789
Assert-AreEqual $resourceFileCount $pool2.StartTask.ResourceFiles.Count

src/ResourceManager/AzureBatch/Commands.Batch.Test/SessionRecords/Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests/TestNewPool.json

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

src/ResourceManager/AzureBatch/Commands.Batch/Microsoft.Azure.Commands.Batch.dll-Help.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,6 +6119,13 @@
61196119
</maml:description>
61206120
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
61216121
</command:parameter>
6122+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none">
6123+
<maml:name>AutoScaleEvaluationInterval</maml:name>
6124+
<maml:description>
6125+
<maml:para>Specifies time interval at which to automatically adjust the pool size according to the AutoScale formula. The default value is 15 minutes. The minimum allowed value is 5 minutes.</maml:para>
6126+
</maml:description>
6127+
<command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue>
6128+
</command:parameter>
61226129
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none">
61236130
<maml:name>AutoScaleFormula</maml:name>
61246131
<maml:description>
@@ -6335,6 +6342,18 @@
63356342
</command:syntaxItem>
63366343
</command:syntax>
63376344
<command:parameters>
6345+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none">
6346+
<maml:name>AutoScaleEvaluationInterval</maml:name>
6347+
<maml:description>
6348+
<maml:para>Specifies time interval at which to automatically adjust the pool size according to the AutoScale formula. The default value is 15 minutes. The minimum allowed value is 5 minutes.</maml:para>
6349+
</maml:description>
6350+
<command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue>
6351+
<dev:type>
6352+
<maml:name>TimeSpan</maml:name>
6353+
<maml:uri />
6354+
</dev:type>
6355+
<dev:defaultValue>none</dev:defaultValue>
6356+
</command:parameter>
63386357
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="none">
63396358
<maml:name>AutoScaleFormula</maml:name>
63406359
<maml:description>

src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.Pools.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public void CreatePool(NewPoolParameters parameters)
9292
if (!string.IsNullOrEmpty(parameters.AutoScaleFormula))
9393
{
9494
pool.AutoScaleEnabled = true;
95+
pool.AutoScaleEvaluationInterval = parameters.AutoScaleEvaluationInterval;
9596
pool.AutoScaleFormula = parameters.AutoScaleFormula;
9697
}
9798
else if (parameters.TargetDedicated.HasValue)

src/ResourceManager/AzureBatch/Commands.Batch/Models/NewPoolParameters.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public NewPoolParameters(BatchAccountContext context, string poolId, IEnumerable
6767
/// </summary>
6868
public int? TargetDedicated { get; set; }
6969

70+
/// <summary>
71+
/// The time interval at which to automatically adjust the pool size according to the AutoScaleFormula.
72+
/// </summary>
73+
public TimeSpan? AutoScaleEvaluationInterval { get; set; }
74+
7075
/// <summary>
7176
/// The AutoScale formula to use with the pool.
7277
/// </summary>

src/ResourceManager/AzureBatch/Commands.Batch/Pools/NewBatchPoolCommand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public class NewBatchPoolCommand : BatchObjectModelCmdletBase
5656
[ValidateNotNullOrEmpty]
5757
public int? TargetDedicated { get; set; }
5858

59+
[Parameter(ParameterSetName = AutoScaleParameterSet)]
60+
[ValidateNotNullOrEmpty]
61+
public TimeSpan? AutoScaleEvaluationInterval { get; set; }
62+
5963
[Parameter(ParameterSetName = AutoScaleParameterSet)]
6064
[ValidateNotNullOrEmpty]
6165
public string AutoScaleFormula { get; set; }
@@ -93,6 +97,7 @@ public override void ExecuteCmdlet()
9397
TargetOSVersion = this.TargetOSVersion,
9498
ResizeTimeout = this.ResizeTimeout,
9599
TargetDedicated = this.TargetDedicated,
100+
AutoScaleEvaluationInterval = this.AutoScaleEvaluationInterval,
96101
AutoScaleFormula = this.AutoScaleFormula,
97102
MaxTasksPerComputeNode = this.MaxTasksPerComputeNode,
98103
TaskSchedulingPolicy = this.TaskSchedulingPolicy,

src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@
265265
<value>Getting accounts in resource group {0}</value>
266266
</data>
267267
<data name="GetSubtaskNoFilter" xml:space="preserve">
268-
<value>Getting all subtasks under task {0}.</value>
268+
<value>Getting all subtask information for task {0}.</value>
269269
</data>
270270
<data name="GetSubtaskOData" xml:space="preserve">
271-
<value>Getting subtasks matching the specified OData filter under task {0}.</value>
271+
<value>Getting subtask information matching the specified OData filter for task {0}.</value>
272272
</data>
273273
<data name="GetTaskById" xml:space="preserve">
274274
<value>Getting task "{0}" from job "{1}"</value>

0 commit comments

Comments
 (0)