Skip to content

Commit b5e089e

Browse files
committed
Regenerate and support Azure Batch SDK 7.1
1 parent 4461c75 commit b5e089e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1420
-275
lines changed

src/ResourceManager/AzureBatch/BatchModelGenerator/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class Program
4646
{"Microsoft.Azure.Batch.CloudTask", "PSCloudTask"},
4747
{"Microsoft.Azure.Batch.CloudServiceConfiguration", "PSCloudServiceConfiguration"},
4848
{"Microsoft.Azure.Batch.ComputeNode", "PSComputeNode"},
49+
{"Microsoft.Azure.Batch.ComputeNodeEndpointConfiguration", "PSComputeNodeEndpointConfiguration"},
4950
{"Microsoft.Azure.Batch.ComputeNodeError", "PSComputeNodeError"},
5051
{"Microsoft.Azure.Batch.ComputeNodeInformation", "PSComputeNodeInformation"},
5152
{"Microsoft.Azure.Batch.ComputeNodeUser", "PSComputeNodeUser"},
@@ -57,6 +58,8 @@ public class Program
5758
{"Microsoft.Azure.Batch.ExitOptions", "PSExitOptions"},
5859
{"Microsoft.Azure.Batch.FileProperties", "PSFileProperties"},
5960
{"Microsoft.Azure.Batch.ImageReference", "PSImageReference"},
61+
{"Microsoft.Azure.Batch.InboundEndpoint", "PSInboundEndpoint"},
62+
{"Microsoft.Azure.Batch.InboundNatPool", "PSInboundNatPool"},
6063
{"Microsoft.Azure.Batch.RemoteLoginSettings", "PSRemoteLoginSettings"},
6164
{"Microsoft.Azure.Batch.JobConstraints", "PSJobConstraints"},
6265
{"Microsoft.Azure.Batch.JobExecutionInformation", "PSJobExecutionInformation"},
@@ -71,13 +74,20 @@ public class Program
7174
{"Microsoft.Azure.Batch.JobSchedulingError", "PSJobSchedulingError"},
7275
{"Microsoft.Azure.Batch.JobSpecification", "PSJobSpecification"},
7376
{"Microsoft.Azure.Batch.JobStatistics", "PSJobStatistics"},
77+
{"Microsoft.Azure.Batch.LinuxUserConfiguration", "PSLinuxUserConfiguration"},
7478
{"Microsoft.Azure.Batch.MetadataItem", "PSMetadataItem"},
7579
{"Microsoft.Azure.Batch.MultiInstanceSettings", "PSMultiInstanceSettings"},
7680
{"Microsoft.Azure.Batch.NameValuePair", "PSNameValuePair"},
7781
{"Microsoft.Azure.Batch.NetworkConfiguration", "PSNetworkConfiguration"},
82+
{"Microsoft.Azure.Batch.NetworkSecurityGroupRule", "PSNetworkSecurityGroupRule"},
7883
{"Microsoft.Azure.Batch.NodeAgentSku", "PSNodeAgentSku"},
7984
{"Microsoft.Azure.Batch.NodeFile", "PSNodeFile"},
8085
{"Microsoft.Azure.Batch.OSDisk", "PSOSDisk"},
86+
{"Microsoft.Azure.Batch.OutputFile", "PSOutputFile"},
87+
{"Microsoft.Azure.Batch.OutputFileDestination", "PSOutputFileDestination"},
88+
{"Microsoft.Azure.Batch.OutputFileUploadOptions", "PSOutputFileUploadOptions"},
89+
{"Microsoft.Azure.Batch.OutputFileBlobContainerDestination", "PSOutputFileBlobContainerDestination"},
90+
{"Microsoft.Azure.Batch.PoolEndpointConfiguration", "PSPoolEndpointConfiguration"},
8191
{"Microsoft.Azure.Batch.PoolInformation", "PSPoolInformation"},
8292
{"Microsoft.Azure.Batch.PoolSpecification", "PSPoolSpecification"},
8393
{"Microsoft.Azure.Batch.PoolStatistics", "PSPoolStatistics"},
@@ -95,7 +105,7 @@ public class Program
95105
{"Microsoft.Azure.Batch.TaskExecutionInformation", "PSTaskExecutionInformation"},
96106
{"Microsoft.Azure.Batch.TaskInformation", "PSTaskInformation"},
97107
{"Microsoft.Azure.Batch.TaskIdRange", "PSTaskIdRange"},
98-
{"Microsoft.Azure.Batch.TaskSchedulingError", "PSTaskSchedulingError"},
108+
{"Microsoft.Azure.Batch.TaskFailureInformation", "PSTaskFailureInformation"},
99109
{"Microsoft.Azure.Batch.TaskSchedulingPolicy", "PSTaskSchedulingPolicy"},
100110
{"Microsoft.Azure.Batch.TaskStatistics", "PSTaskStatistics"},
101111
{"Microsoft.Azure.Batch.UsageStatistics", "PSUsageStatistics"},

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<Reference Include="Hyak.Common">
4545
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
4646
</Reference>
47-
<Reference Include="Microsoft.Azure.Batch, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\..\..\packages\Azure.Batch.6.1.0\lib\net45\Microsoft.Azure.Batch.dll</HintPath>
47+
<Reference Include="Microsoft.Azure.Batch, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48+
<HintPath>..\..\..\packages\Azure.Batch.7.1.0\lib\net452\Microsoft.Azure.Batch.dll</HintPath>
4949
</Reference>
5050
<Reference Include="Microsoft.Azure.Common">
5151
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
@@ -98,12 +98,10 @@
9898
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
9999
</Reference>
100100
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
101-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
102-
<Private>True</Private>
101+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
103102
</Reference>
104103
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
105-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
106-
<Private>True</Private>
104+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
107105
</Reference>
108106
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
109107
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>

src/ResourceManager/AzureBatch/Commands.Batch.Test/Jobs/NewBatchJobCommandTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void NewBatchJobPoolUserAccountsGetPassedToRequest()
172172

173173
PSUserAccount adminUser = new PSUserAccount("admin", "password1", Azure.Batch.Common.ElevationLevel.Admin);
174174
PSUserAccount nonAdminUser = new PSUserAccount("user2", "password2", Azure.Batch.Common.ElevationLevel.NonAdmin);
175-
PSUserAccount sshUser = new PSUserAccount("user3", "password3", sshPrivateKey: "my ssh key");
175+
PSUserAccount sshUser = new PSUserAccount("user3", "password3", Azure.Batch.Common.ElevationLevel.Admin, new PSLinuxUserConfiguration(uid: 1, gid:2, sshPrivateKey: "my ssh key"));
176176
cmdlet.PoolInformation = new PSPoolInformation
177177
{
178178
AutoPoolSpecification = new PSAutoPoolSpecification
@@ -214,7 +214,9 @@ public void NewBatchJobPoolUserAccountsGetPassedToRequest()
214214
Assert.Equal(sshUser.Password, requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].Password);
215215
Assert.Equal(sshUser.ElevationLevel.ToString().ToLowerInvariant(),
216216
requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].ElevationLevel.ToString().ToLowerInvariant());
217-
Assert.Equal(sshUser.SshPrivateKey, requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].SshPrivateKey);
217+
Assert.Equal(sshUser.LinuxUserConfiguration.Uid, requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].LinuxUserConfiguration.Uid);
218+
Assert.Equal(sshUser.LinuxUserConfiguration.Gid, requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].LinuxUserConfiguration.Gid);
219+
Assert.Equal(sshUser.LinuxUserConfiguration.SshPrivateKey, requestParameters.PoolInfo.AutoPoolSpecification.Pool.UserAccounts[2].LinuxUserConfiguration.SshPrivateKey);
218220
}
219221
}
220222
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/Pools/NewBatchPoolCommandTests.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
9797
cmdlet.Metadata.Add("meta1", "value1");
9898
cmdlet.ResizeTimeout = TimeSpan.FromMinutes(20);
9999
cmdlet.StartTask = new PSStartTask("cmd /c echo start task");
100-
cmdlet.TargetDedicated = 3;
100+
cmdlet.TargetDedicatedComputeNodes = 3;
101+
cmdlet.TargetLowPriorityComputeNodes = 2;
101102
cmdlet.TaskSchedulingPolicy = new PSTaskSchedulingPolicy(Azure.Batch.Common.ComputeNodeFillType.Spread);
102103
cmdlet.VirtualMachineConfiguration = new PSVirtualMachineConfiguration("node agent", new PSImageReference("offer", "publisher", "sku"));
103104
cmdlet.VirtualMachineSize = "small";
@@ -130,7 +131,8 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
130131
Assert.Equal(cmdlet.Metadata["meta1"], requestParameters.Metadata[0].Value);
131132
Assert.Equal(cmdlet.ResizeTimeout, requestParameters.ResizeTimeout);
132133
Assert.Equal(cmdlet.StartTask.CommandLine, requestParameters.StartTask.CommandLine);
133-
Assert.Equal(cmdlet.TargetDedicated, requestParameters.TargetDedicated);
134+
Assert.Equal(cmdlet.TargetDedicatedComputeNodes, requestParameters.TargetDedicatedNodes);
135+
Assert.Equal(cmdlet.TargetLowPriorityComputeNodes, requestParameters.TargetLowPriorityNodes);
134136
Assert.Equal(cmdlet.TaskSchedulingPolicy.ComputeNodeFillType.ToString(), requestParameters.TaskSchedulingPolicy.NodeFillType.ToString());
135137
Assert.Equal(cmdlet.VirtualMachineConfiguration.NodeAgentSkuId, requestParameters.VirtualMachineConfiguration.NodeAgentSKUId);
136138
Assert.Equal(cmdlet.VirtualMachineConfiguration.ImageReference.Publisher, requestParameters.VirtualMachineConfiguration.ImageReference.Publisher);
@@ -168,7 +170,7 @@ public void NewBatchPoolAutoScaleHandledProperlyTest()
168170
Assert.Equal(cmdlet.AutoScaleEvaluationInterval, requestParameters.AutoScaleEvaluationInterval);
169171
Assert.Equal(cmdlet.AutoScaleFormula, requestParameters.AutoScaleFormula);
170172
Assert.Equal(true, requestParameters.EnableAutoScale);
171-
Assert.Equal(null, requestParameters.TargetDedicated);
173+
Assert.Equal(null, requestParameters.TargetDedicatedNodes);
172174
}
173175

174176
[Fact]
@@ -215,7 +217,7 @@ public void NewBatchPoolOSDiskGetsPassedToRequest()
215217
cmdlet.BatchContext = context;
216218

217219
cmdlet.Id = "testPool";
218-
cmdlet.TargetDedicated = 3;
220+
cmdlet.TargetDedicatedComputeNodes = 3;
219221

220222
List<string> imageUrls = new List<string>() { "https://image1.vhd", "https://image2.vhd" };
221223
Azure.Batch.Common.CachingType cachingType = Azure.Batch.Common.CachingType.ReadWrite;
@@ -251,12 +253,12 @@ public void NewBatchPoolUserAccountsGetPassedToRequest()
251253

252254
cmdlet.Id = "testPool";
253255
cmdlet.CloudServiceConfiguration = new PSCloudServiceConfiguration("4", "*");
254-
cmdlet.TargetDedicated = 3;
256+
cmdlet.TargetDedicatedComputeNodes = 3;
255257

256258
PSUserAccount adminUser = new PSUserAccount("admin", "password1", Azure.Batch.Common.ElevationLevel.Admin);
257259
PSUserAccount nonAdminUser = new PSUserAccount("user2", "password2", Azure.Batch.Common.ElevationLevel.NonAdmin);
258-
PSUserAccount sshUser = new PSUserAccount("user3", "password3", sshPrivateKey: "my ssh key");
259-
cmdlet.UserAccounts = new PSUserAccount[] { adminUser, nonAdminUser, sshUser };
260+
PSUserAccount sshUser = new PSUserAccount("user3", "password3", linuxUserConfiguration: new PSLinuxUserConfiguration(uid: 1, gid: 2, sshPrivateKey: "my ssh key"));
261+
cmdlet.UserAccounts = new [] { adminUser, nonAdminUser, sshUser };
260262

261263
PoolAddParameter requestParameters = null;
262264

@@ -286,7 +288,9 @@ public void NewBatchPoolUserAccountsGetPassedToRequest()
286288
Assert.Equal(sshUser.Password, requestParameters.UserAccounts[2].Password);
287289
Assert.Equal(sshUser.ElevationLevel.ToString().ToLowerInvariant(),
288290
requestParameters.UserAccounts[2].ElevationLevel.ToString().ToLowerInvariant());
289-
Assert.Equal(sshUser.SshPrivateKey, requestParameters.UserAccounts[2].SshPrivateKey);
291+
Assert.Equal(sshUser.LinuxUserConfiguration.Uid, requestParameters.UserAccounts[2].LinuxUserConfiguration.Uid);
292+
Assert.Equal(sshUser.LinuxUserConfiguration.Gid, requestParameters.UserAccounts[2].LinuxUserConfiguration.Gid);
293+
Assert.Equal(sshUser.LinuxUserConfiguration.SshPrivateKey, requestParameters.UserAccounts[2].LinuxUserConfiguration.SshPrivateKey);
290294
}
291295
}
292296
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchApplicationPackageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void TestUpdatePoolWithApplicationPackage()
135135
{
136136
context = new ScenarioTestContext();
137137
ScenarioTestHelpers.CreateApplicationPackage(controller, context, id, version, filePath);
138-
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 1);
138+
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, targetDedicated: 1, targetLowPriority: 0);
139139
},
140140
() =>
141141
{

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/CertificateTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void TestCancelCertificateDelete()
5454
certRef.ThumbprintAlgorithm = BatchTestHelpers.TestCertificateAlgorithm;
5555
certRef.Thumbprint = thumbprint;
5656
certRef.Visibility = CertificateVisibility.Task;
57-
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0, certRef);
57+
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, targetDedicated: 0, targetLowPriority: 0, certReference: certRef);
5858
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
5959
ScenarioTestHelpers.WaitForCertificateToFailDeletion(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
6060
},

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/ComputeNodeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void TestRemoveComputeNodes()
4040
() =>
4141
{
4242
context = new ScenarioTestContext();
43-
ScenarioTestHelpers.CreateTestPool(controller, context, removeNodePoolId, 2);
43+
ScenarioTestHelpers.CreateTestPool(controller, context, removeNodePoolId, targetDedicated: 2, targetLowPriority: 0);
4444
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, removeNodePoolId);
4545
},
4646
() =>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void TestResizeAndStopResizePool()
4949
() =>
5050
{
5151
context = new ScenarioTestContext();
52-
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0);
52+
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, targetDedicated: 0, targetLowPriority: 0);
5353
},
5454
() =>
5555
{
@@ -71,7 +71,7 @@ public void TestAutoScaleActions()
7171
() =>
7272
{
7373
context = new ScenarioTestContext();
74-
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0);
74+
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, targetDedicated: 0, targetLowPriority: 0);
7575
},
7676
() =>
7777
{
@@ -93,7 +93,7 @@ public void TestChangeOSVersion()
9393
() =>
9494
{
9595
context = new ScenarioTestContext();
96-
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0);
96+
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, targetDedicated: 0, targetLowPriority: 0);
9797
},
9898
() =>
9999
{

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/ScenarioTestHelpers.cs

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ public static void WaitForCertificateToFailDeletion(BatchController controller,
168168
/// <summary>
169169
/// Creates a test pool for use in Scenario tests.
170170
/// </summary>
171-
public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated,
172-
CertificateReference certReference = null, StartTask startTask = null)
171+
public static void CreateTestPool(
172+
BatchController controller,
173+
BatchAccountContext context,
174+
string poolId,
175+
int? targetDedicated,
176+
int? targetLowPriority,
177+
CertificateReference certReference = null,
178+
StartTask startTask = null)
173179
{
174180
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
175181

@@ -190,7 +196,8 @@ public static void CreateTestPool(BatchController controller, BatchAccountContex
190196
{
191197
VirtualMachineSize = "small",
192198
CloudServiceConfiguration = paasConfiguration,
193-
TargetDedicated = targetDedicated,
199+
TargetDedicatedComputeNodes = targetDedicated,
200+
TargetLowPriorityComputeNodes = targetLowPriority,
194201
CertificateReferences = certReferences,
195202
StartTask = psStartTask,
196203
InterComputeNodeCommunicationEnabled = true
@@ -225,19 +232,7 @@ public static void CreateMpiPoolIfNotExists(BatchController controller, BatchAcc
225232
// We got the pool not found error, so continue and create the pool
226233
}
227234

228-
CreateTestPool(controller, context, MpiPoolId, targetDedicated);
229-
}
230-
231-
public static void ResizePool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated)
232-
{
233-
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
234-
235-
PoolResizeParameters parameters = new PoolResizeParameters(context, poolId, null)
236-
{
237-
TargetDedicated = targetDedicated
238-
};
239-
240-
client.ResizePool(parameters);
235+
CreateTestPool(controller, context, MpiPoolId, targetDedicated, targetLowPriority: 0);
241236
}
242237

243238
public static void WaitForSteadyPoolAllocation(BatchController controller, BatchAccountContext context, string poolId)
@@ -262,22 +257,6 @@ public static void WaitForSteadyPoolAllocation(BatchController controller, Batch
262257
}
263258
}
264259

265-
/// <summary>
266-
/// Gets the CurrentDedicated count from a pool
267-
/// </summary>
268-
public static int GetPoolCurrentDedicated(BatchController controller, BatchAccountContext context, string poolId)
269-
{
270-
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
271-
272-
ListPoolOptions options = new ListPoolOptions(context)
273-
{
274-
PoolId = poolId
275-
};
276-
277-
PSCloudPool pool = client.ListPools(options).First();
278-
return pool.CurrentDedicated.Value;
279-
}
280-
281260
/// <summary>
282261
/// Gets the number of pools under the specified account
283262
/// </summary>

0 commit comments

Comments
 (0)