Skip to content

Commit 150648f

Browse files
committed
inital checkin
1 parent 1772c5a commit 150648f

File tree

222 files changed

+11673
-8235
lines changed

Some content is hidden

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

222 files changed

+11673
-8235
lines changed

sdk/batch/Azure.Compute.Batch/CHANGELOG.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Release History
22

3-
## 1.0.0-beta.3 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
3+
## 1.0.0 (2025-03-27)
4+
5+
This release is the first stable release of the Azure Compute Batch client library.
106

117
### Other Changes
8+
9+
Documenation updates.
1210

1311
## 1.0.0-beta.2 (2025-02-28)
1412

@@ -26,8 +24,8 @@
2624
- Added `containerHostBatchBindMounts` of type `List<ContainerHostBatchBindMountEntry>` to `BatchTaskContainerSettings`.
2725

2826
- Patch improvements for pool and job:
29-
- Added `displayName`, `vmSize`, `taskSlotsPerNode`, `taskSchedulingPolicy`, `enableInterNodeCommunication`, `virtualMachineConfiguration`, `networkConfiguration`, `userAccounts`, `mountConfiguration`, `upgradePolicy`, and `resourceTags` to `BatchPoolUpdateContent`.
30-
- Added `networkConfiguration` to `BatchJobUpdateContent`.
27+
- Added `displayName`, `vmSize`, `taskSlotsPerNode`, `taskSchedulingPolicy`, `enableInterNodeCommunication`, `virtualMachineConfiguration`, `networkConfiguration`, `userAccounts`, `mountConfiguration`, `upgradePolicy`, and `resourceTags` to `BatchPoolUpdateOptions`.
28+
- Added `networkConfiguration` to `BatchJobUpdateOptions`.
3129

3230
- Confidential VM support:
3331
- Added `confidentialVM` to `SecurityTypes`.

sdk/batch/Azure.Compute.Batch/MigrationGuide.md

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

sdk/batch/Azure.Compute.Batch/README.md

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

sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.net8.0.cs

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

sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.netstandard2.0.cs

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

sdk/batch/Azure.Compute.Batch/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/batch/Azure.Compute.Batch",
5-
"Tag": "net/batch/Azure.Compute.Batch_40246b7ff5"
5+
"Tag": "net/batch/Azure.Compute.Batch_dcf3a3e145"
66
}

sdk/batch/Azure.Compute.Batch/samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ description: Samples for the Azure.Compute.Batch client library
1313
Before starting, take a look at the Azure Batch [README](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/batch/Azure.Compute.Batch/README.md) for more information on how to create an Batch Account using the Azure portal/Azure CLI, and retrieving the designated endpoint and credential.
1414

1515
- [Creating a Pool, Job, and Task](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/batch/Azure.Compute.Batch/samples/Sample1_CreatePool_Job_Task.md)
16-
- [Creating multiple Task](https://github.com/Azure/azure-sdk-for-net/blob/50a965255278aa2ca604daef81e26632f5b668f3/sdk/batch/Azure.Compute.Batch/samples/Sample2_Creating_Multiple_Tasks.md)
16+
- [Creating multiple Task](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/batch/Azure.Compute.Batch/samples/Sample2_Creating_Multiple_Tasks.md)

sdk/batch/Azure.Compute.Batch/samples/Sample1_CreatePool_Job_Task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ With the BatchAccountResource you can create a pool with the [batchAccount.GetBa
2828

2929
```C# Snippet:Batch_Sample01_PoolCreation
3030
var poolName = "HelloWorldPool";
31-
var imageReference = new BatchImageReference()
31+
var imageReference = new Azure.ResourceManager.Batch.Models.BatchImageReference()
3232
{
3333
Publisher = "canonical",
3434
Offer = "0001-com-ubuntu-server-jammy",
@@ -71,14 +71,14 @@ new Uri("https://examplebatchaccount.eastus.batch.azure.com"), credential);
7171
Before we can create Batch Tasks, we first need to create a Job for the tasks to be associatd with, this can be done via the `CreateJobAsync` command. The basic elements needed are an id for job itself and the name of the pool that this job will run against.
7272

7373
```C# Snippet:Batch_Sample01_CreateBatchJob
74-
await batchClient.CreateJobAsync(new BatchJobCreateContent("jobId", new BatchPoolInfo() { PoolId = "poolName" }));
74+
await batchClient.CreateJobAsync(new BatchJobCreateOptions("jobId", new BatchPoolInfo() { PoolId = "poolName" }));
7575
```
7676

7777
### Task creation
7878

7979
Batch tasks can be created from the BatchClient via the `CreateTaskAsync`. The basic elements needed are the name of the job the task will be assigned to, and id for the task itself, and a command to run.
8080
```C# Snippet:Batch_Sample01_CreateBatchTask
81-
await batchClient.CreateTaskAsync("jobId", new BatchTaskCreateContent("taskId", $"echo Hello world"));
81+
await batchClient.CreateTaskAsync("jobId", new BatchTaskCreateOptions("taskId", $"echo Hello world"));
8282
```
8383

8484

sdk/batch/Azure.Compute.Batch/samples/Sample2_Creating_Multiple_Tasks.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ With the BatchAccountResource you can create a pool with the [batchAccount.GetBa
2828

2929
```C# Snippet:Batch_Sample02_PoolCreation
3030
var poolName = "HelloWorldPool";
31-
var imageReference = new BatchImageReference()
31+
var imageReference = new Azure.ResourceManager.Batch.Models.BatchImageReference()
3232
{
3333
Publisher = "canonical",
3434
Offer = "0001-com-ubuntu-server-jammy",
@@ -71,7 +71,7 @@ new Uri("https://examplebatchaccount.eastus.batch.azure.com"), credential);
7171
Before we can create Batch Tasks, we first need to create a Job for the tasks to be associatd with, this can be done via the `CreateJobAsync` command. The basic elements needed are an id for job itself and the name of the pool that this job will run against.
7272

7373
```C# Snippet:Batch_Sample02_CreateBatchJob
74-
await batchClient.CreateJobAsync(new BatchJobCreateContent("jobId", new BatchPoolInfo() { PoolId = "poolName" }));
74+
await batchClient.CreateJobAsync(new BatchJobCreateOptions("jobId", new BatchPoolInfo() { PoolId = "poolName" }));
7575
```
7676

7777
### Task creation
@@ -107,27 +107,27 @@ In the following code example a list of 1000 tasks are created of type `BatchTas
107107
108108
```C# Snippet:Batch_Sample02_CreateTasks_Default
109109
int tasksCount = 1000;
110-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
110+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
111111
for (int i = 0; i < tasksCount; i++)
112112
{
113-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
113+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
114114
}
115115

116116
// Create 1000 tasks in a single request using the default settings
117117
CreateTasksResult result = await batchClient.CreateTasksAsync("jobId", tasks);
118118

119119
// Print the results
120-
Console.WriteLine("{0} Tasks Passed, {1} Failed.", result.Pass, result.Fail);
120+
Console.WriteLine("{0} Tasks Passed, {1} Failed.", result.PassCount, result.FailCount);
121121
```
122122

123123
By default `CreateTasksResult` will only contain a count of the Pass/Fail results but if you want the list of the `BatchTaskAddResult` results returned by the service you can pass in a CreateTasksOptions to the AddTasks method with the field ReturnBatchTaskAddResults set to true. This is disabled by default because the size of the list scales with the number of requests so memory constrants could be a factor.
124124

125125
```C# Snippet:Batch_Sample02_CreateTasks_ReturnBatchTaskAddResults
126126
int tasksCount = 1000;
127-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
127+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
128128
for (int i = 0; i < tasksCount; i++)
129129
{
130-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
130+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
131131
}
132132

133133
// Create a CreateTaskOptions object with custom settings for the BatchTaskAddResults to be returned.
@@ -136,7 +136,7 @@ CreateTasksOptions createTaskOptions = new CreateTasksOptions(returnBatchTaskAdd
136136
// Create 1000 tasks in a single request over 10 parallel requests
137137
CreateTasksResult result = await batchClient.CreateTasksAsync("jobId", tasks, createTaskOptions);
138138

139-
foreach (BatchTaskAddResult t in result.BatchTaskAddResults)
139+
foreach (BatchTaskCreateResult t in result.BatchTaskCreateResults)
140140
{
141141
Console.WriteLine("Task {0} created with status {1}. ",
142142
t.TaskId, t.Status);
@@ -147,23 +147,23 @@ Alternatively you can call `CreateTasks()` with an instance of `CreateTasksOptio
147147

148148
```C# Snippet:Batch_Sample02_CreateTasks_ParallelOptions
149149
int tasksCount = 1000;
150-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
150+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
151151
for (int i = 0; i < tasksCount; i++)
152152
{
153-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
153+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
154154
}
155155

156156
// Create a CreateTaskOptions object with custom settings for parallelism
157157
CreateTasksOptions createTaskOptions = new CreateTasksOptions()
158158
{
159159
MaxDegreeOfParallelism = 10,
160-
ReturnBatchTaskAddResults = true
160+
ReturnBatchTaskCreateResults = true
161161
};
162162

163163
// Create 1000 tasks in a single request over 10 parallel requests
164164
CreateTasksResult result = await batchClient.CreateTasksAsync("jobId", tasks, createTaskOptions);
165165

166-
foreach (BatchTaskAddResult t in result.BatchTaskAddResults)
166+
foreach (BatchTaskCreateResult t in result.BatchTaskCreateResults)
167167
{
168168
Console.WriteLine("Task {0} created with status {1}. ",
169169
t.TaskId, t.Status);
@@ -174,10 +174,10 @@ Addiontally you can call `CreateTasks()` with an instance of `CreateTasksOptions
174174

175175
```C# Snippet:Batch_Sample02_CreateTasks_MaxTimeBetweenCallsInSeconds
176176
int tasksCount = 1000;
177-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
177+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
178178
for (int i = 0; i < tasksCount; i++)
179179
{
180-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
180+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
181181
}
182182

183183
// Create a CreateTaskOptions object with custom settings for
@@ -187,13 +187,13 @@ CreateTasksOptions createTaskOptions = new CreateTasksOptions()
187187
{
188188
MaxDegreeOfParallelism = 10,
189189
MaxTimeBetweenCallsInSeconds = 60,
190-
ReturnBatchTaskAddResults = true
190+
ReturnBatchTaskCreateResults = true
191191
};
192192

193193
// Create 1000 tasks in a single request over 10 parallel requests
194194
CreateTasksResult result = await batchClient.CreateTasksAsync("jobId", tasks, createTaskOptions);
195195

196-
foreach (BatchTaskAddResult t in result.BatchTaskAddResults)
196+
foreach (BatchTaskCreateResult t in result.BatchTaskCreateResults)
197197
{
198198
Console.WriteLine("Task {0} created with status {1}. ",
199199
t.TaskId, t.Status);
@@ -204,10 +204,10 @@ Addtional parameters to the `CreateTasks()` method can be set such as `timeOutIn
204204

205205
```C# Snippet:Batch_Sample02_CreateTasks_Non_Default
206206
int tasksCount = 1000;
207-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
207+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
208208
for (int i = 0; i < tasksCount; i++)
209209
{
210-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
210+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
211211
}
212212

213213
// Create a CancellationTokenSource object to cancel the operation if need be
@@ -218,7 +218,7 @@ var cts = new CancellationTokenSource();
218218
CreateTasksOptions createTaskOptions = new CreateTasksOptions()
219219
{
220220
MaxDegreeOfParallelism = 10,
221-
ReturnBatchTaskAddResults = true
221+
ReturnBatchTaskCreateResults = true
222222
};
223223

224224
try
@@ -234,7 +234,7 @@ try
234234
);
235235

236236
// Print the results
237-
Console.WriteLine("{0} Tasks Passed, {1} Failed.", result.Pass, result.Fail);
237+
Console.WriteLine("{0} Tasks Passed, {1} Failed.", result.PassCount, result.FailCount);
238238
}
239239
catch (ParallelOperationsException)
240240
{
@@ -254,7 +254,7 @@ Here's and example of a custom implmentation of `ICreateTaskResultHandler`
254254
/// <summary>
255255
/// Custom TaskCollectionResultHandler to handle the result of a CreateTasksAsync operation.
256256
/// </summary>
257-
private class CustomTaskCollectionResultHandler : ICreateTaskResultHandler
257+
private class CustomTaskCollectionResultHandler : TaskResultHandler
258258
{
259259
/// <summary>
260260
/// This handler treats and result without errors as Success, 'TaskExists' errors as failures, retries server errors (HTTP 5xx),
@@ -265,7 +265,7 @@ private class CustomTaskCollectionResultHandler : ICreateTaskResultHandler
265265
/// <param name="cancellationToken">The cancellation token associated with the AddTaskCollection operation.</param>
266266
/// <returns>An <see cref="CreateTaskResultStatus"/> which indicates whether the <paramref name="addTaskResult"/>
267267
/// is classified as a success or as requiring a retry.</returns>
268-
public CreateTaskResultStatus CreateTaskResultHandler(CreateTaskResult addTaskResult, CancellationToken cancellationToken)
268+
public override CreateTaskResultStatus CreateTaskResultHandler(CreateTaskResult addTaskResult, CancellationToken cancellationToken)
269269
{
270270
if (addTaskResult == null)
271271
{
@@ -280,7 +280,7 @@ private class CustomTaskCollectionResultHandler : ICreateTaskResultHandler
280280
{
281281
status = CreateTaskResultStatus.Retry;
282282
}
283-
else if (addTaskResult.BatchTaskResult.Status == BatchTaskAddStatus.ClientError && addTaskResult.BatchTaskResult.Error.Code == BatchErrorCodeStrings.TaskExists)
283+
else if (addTaskResult.BatchTaskResult.Status == BatchTaskAddStatus.ClientError && addTaskResult.BatchTaskResult.Error.Code == BatchErrorCode.TaskExists)
284284
{
285285
status = CreateTaskResultStatus.Failure; //TaskExists mark as failure
286286
}
@@ -297,24 +297,24 @@ Here is an example of the custom CreateTaskResultHandler being used.
297297

298298
```C# Snippet:Batch_Sample02_CreateTasks_Custom_TaskCollectionResultHandler
299299
int tasksCount = 1000;
300-
List<BatchTaskCreateContent> tasks = new List<BatchTaskCreateContent>();
300+
List<BatchTaskCreateOptions> tasks = new List<BatchTaskCreateOptions>();
301301
for (int i = 0; i < tasksCount; i++)
302302
{
303-
tasks.Add(new BatchTaskCreateContent($"task{i}", "cmd /c echo Hello World"));
303+
tasks.Add(new BatchTaskCreateOptions($"task{i}", "cmd /c echo Hello World"));
304304
}
305305

306306
// Create a CreateTaskOptions object with a custom CreateTaskResultHandler
307307
CreateTasksOptions createTaskOptions = new CreateTasksOptions()
308308
{
309309
CreateTaskResultHandler = new CustomTaskCollectionResultHandler(),
310-
ReturnBatchTaskAddResults = true
310+
ReturnBatchTaskCreateResults = true
311311
};
312312

313313
// Create 1000 tasks in a single request using the default settings
314314
CreateTasksResult result = await batchClient.CreateTasksAsync("jobId", tasks, createTaskOptions);
315315

316316
// Print the status of each task creation
317-
foreach (BatchTaskAddResult t in result.BatchTaskAddResults)
317+
foreach (BatchTaskCreateResult t in result.BatchTaskCreateResults)
318318
{
319319
Console.WriteLine("Task {0} created with status {1}. ",
320320
t.TaskId, t.Status);

sdk/batch/Azure.Compute.Batch/src/Azure.Compute.Batch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<Description>This is the Azure.Compute.Batch client library, enabling the creation and management of Batch objects such as Pools, Jobs, and Tasks. For more information about Azure Batch, see https://learn.microsoft.com/azure/batch/batch-technical-overview </Description>
44
<AssemblyTitle>The Azure Batch client library</AssemblyTitle>
5-
<Version>1.0.0-beta.3</Version>
5+
<Version>1.0.0</Version>
66
<PackageTags>Azure.Compute.Batch</PackageTags>
77
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
88
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>

0 commit comments

Comments
 (0)