Skip to content
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
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-->
<ItemGroup Condition="'$(IsClientLibrary)' != 'true'">
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.4.11" />
<PackageReference Update="Microsoft.Azure.Batch" Version="11.0.0" />
<PackageReference Update="Microsoft.Azure.Batch" Version="14.0.0" />
<PackageReference Update="Microsoft.Azure.Devices.Client" Version="1.23.2" />
<PackageReference Update="Microsoft.Azure.Devices" Version="1.19.0" />
<PackageReference Update="Microsoft.Azure.KeyVault.Core" Version="3.0.3" />
Expand Down
4 changes: 4 additions & 0 deletions sdk/batch/Microsoft.Azure.Batch/.markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD013": false,
"MD024": { "siblings_only": true }
}
259 changes: 182 additions & 77 deletions sdk/batch/Microsoft.Azure.Batch/CHANGELOG.md

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions sdk/batch/Microsoft.Azure.Batch/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# License notes

The Azure Batch C# client is now under the MIT license. Prior to March 10 2017 it was under the Apache 2.0 license.

# Azure Batch SDK developer guide
## Azure Batch SDK developer guide

`Microsoft.Azure.Batch.sln` is your one stop shop for all things related to the Azure Batch C# client library. This solution file contains all of the projects affiliated with the Azure Batch client (including testing and tooling).

## Changing the Azure Batch client

Depending on the type of change you want to make, the work required varies. If you follow this process you shouldn't miss anything:

1. Update the Azure Batch Swagger specification, which resides in the [Azure/azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs) GitHub repository (specifically [here](https://github.com/Azure/azure-rest-api-specs/tree/master/specification/batch/data-plane))
Expand All @@ -23,32 +26,35 @@ Depending on the type of change you want to make, the work required varies. If y
* The `src\IProtocolLayer.cs` interface.
* The `src\ProtocolLayer.cs` class.
* The corresponding operations class, for example `PoolOperations.cs`.
* The corresponding entity which the operation is performed on, for example `CloudPool.cs`.
* The corresponding entity which the operation is performed on, for example `CloudPool.cs`.
7. Add tests for your new models and APIs into the correct test projects.
* `Azure.Batch.Unit.Tests` for unit tests. These tests do not have any external dependencies (they run entirely in-memory) and are used in the continuous integration job to validate checkins.
* `Azure.Batch.Unit.Tests` for unit tests. These tests do not have any external dependencies (they run entirely in-memory) and are used in the continuous integration job to validate checkins.
* `BatchClientIntegrationTests` for integration tests. These tests run against a live Azure Batch endpoint and do not run during CI. See [running the end to end tests](#running-the-end-to-end-tests) for more details about how to run these tests.
* **Note:** You should prefer to add unit tests over integration tests where possible -- integration tests should be reserved for ensuring that the Batch Service accepts the Swagger requests. Testing service behavior should occur in a service test, not the client.
8. Update the `CHANGELOG.md` file and the `Version` tag in `src/Microsoft.Azure.Batch.csproj`. Ensure that if you are making a breaking change, you update the major version of the version number.
9. Run the tests and ensure that they pass.
10. Open a PR to https://github.com/Azure/azure-sdk-for-net
10. Open a PR to <https://github.com/Azure/azure-sdk-for-net>

### Generate the `src\GeneratedProtocol` folder using AutoRest

The GeneratedProtocol folder holds the code generated by the [AutoRest](https://github.com/Azure/autorest) tool from a Swagger specification. The AutoRest tool has a command line interface of its own which you can use directly, or you can run `powershell Start-AutoRestCodeGeneration -ResourceProvider "batch/data-plane" -SdkRepoRootPath "<path to root of this repo>" -AutoRestVersion "latest" -SdkGenerationDirectory "<path to root of this repo>\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol" -ConfigFileTag "package-2020-03.11.0"`

### Generate the `src\Generated` folder

This folder contains the convenience layer models for Azure Batch. It is generated from a custom tool. The custom tool reads all of the specification files located in `Tools\ObjectModelCodeGenerator\Spec`. The convenience layer models require more metadata than the Swagger specification provides, so this file is an extra mapping layer on top of Swagger which provides more detail. **Note:** These specification files are all about the models, they have nothing to do with the actual APIs.

1. New entities defined in the Swagger specification have to be added here as well. See an existing entity for an example.
2. If the type or name of a property has changed in the underlying Swagger specification, it should be updated here as well.

There are a number of special flags which have meaning in the specification files. The easiest way to see a list of what flags are supported and at what level is to look at the backing code generation code:

1. For properties: `Tools\ObjectModelCodeGeneration\CodeGenerationLibrary\PropertyData.cs`
1. For properties: `Tools\ObjectModelCodeGeneration\CodeGenerationLibrary\PropertyData.cs`
2. For types: `Tools\ObjectModelCodeGeneration\CodeGenerationLibrary\ObjectModelTypeData.cs`

Once you have added and updated the required files in `Tools\ObjectModelCodeGenerator\Spec` mark the `ObjectModelCodeGenerator` as your startup project in Visual Studio and run it -- it will regenerate the contents of the `src\Generated` folder.

## Running the end to end tests

A full end to end test pass takes 20-40 minutes.
The following environment variables must be set for the the end to end tests to work - it is recommended to set up a script which sets these all so that it can easily be reused later:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public static bool IsTypeComplex(string typeString)
typeString.Equals("TimeSpan") ||
typeString.Equals("TimeSpan?") ||
typeString.Equals("DateTime") ||
typeString.Equals("DateTime?"));
typeString.Equals("DateTime?") ||
typeString.Equals("object"));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "ComputeNodeIdentityReference",
"Name": "IdentityReference",
"SummaryComment": "The reference to the user assigned identity to use to access containerName",
"RemarksComment": "This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified.",
"BoundAccess": "read",
"UnboundAccess": "read,write"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"Name": "BatchPoolIdentity",
"ProtocolName": "Models.BatchPoolIdentity",
"SummaryComment": "The identity of the Batch pool, if configured.",
"IsConstructorPublic": false,
"Properties": [
{
"Key": {
"Type": "Common.PoolIdentityType",
"Name": "Type",
"SummaryComment": "The identity of the Batch pool, if configured.",
"RemarksComment": "The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
"BoundAccess": "read",
"UnboundAccess": "read,write",
"ConstructorArgumentType": "Required"
},
"Value": {
"Type": "Models.PoolIdentityType",
"Name": "Type"
}
},
{
"Key": {
"Type": "IList<UserAssignedIdentity>",
"Name": "UserAssignedIdentities",
"SummaryComment": "The list of user identities associated with the Batch account.",
"RemarksComment": "The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
"BoundAccess": "read",
"UnboundAccess": "read,write"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@
"UnboundAccess": "read,write"
},
"Value": null
},
{
"Key": {
"Type": "int?",
"Name": "MaxParallelTasks",
"SummaryComment": "The maximum number of tasks that can be executed in parallel for the job.",
"RemarksComment": "The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.",
"BoundAccess": "read,write",
"UnboundAccess": "read,write"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,17 @@
"Type": "IList<Models.MountConfiguration>",
"Name": "MountConfiguration"
}
},
{
"Key": {
"Type": "BatchPoolIdentity",
"Name": "Identity",
"SummaryComment": "The identity of the Batch pool, if configured.",
"RemarksComment": "The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
"BoundAccess": "read,write",
"UnboundAccess": "read,write"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@
"Type": "int?",
"Name": "RunningTaskSlotsCount"
}
},
{
"Key": {
"Type": "VirtualMachineInfo",
"Name": "VirtualMachineInfo",
"SummaryComment": "Info about the current state of the virtual machine.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "none"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Name": "ComputeNodeIdentityReference",
"ProtocolName": "Models.ComputeNodeIdentityReference",
"SummaryComment": "The reference to a user assigned identity associated with the Batch pool which a compute node will use.",
"Properties": [
{
"Key": {
"Type": "string",
"Name": "ResourceId",
"SummaryComment": "The ARM resource id of the user assigned identity.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,47 @@
{
"Key": {
"Type": "string",
"Name": "RegistryServer",
"SummaryComment": "The registry URL.",
"RemarksComment": "If omitted, the default is \"docker.io\".",
"Name": "UserName",
"SummaryComment": "The user name to log into the registry server.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"ConstructorArgumentType": "Optional",
"ConstructorArgumentType": "Required",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "string",
"Name": "UserName",
"SummaryComment": "The user name to log into the registry server.",
"Name": "Password",
"SummaryComment": "The password to log into the registry server.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"ConstructorArgumentType": "Required",
"ConstructorArgumentType": "Optional",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "string",
"Name": "Password",
"SummaryComment": "The password to log into the registry server.",
"Name": "RegistryServer",
"SummaryComment": "The registry URL.",
"RemarksComment": "If omitted, the default is \"docker.io\".",
"BoundAccess": "read",
"UnboundAccess": "read,write",
"ConstructorArgumentType": "Optional",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "ComputeNodeIdentityReference",
"Name": "IdentityReference",
"SummaryComment": "The reference to the user assigned identity to use to access an Azure Container Registry instead of username and password.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Name": "DiffDiskSettings",
"ProtocolName": "Models.DiffDiskSettings",
"SummaryComment": "Specifies the ephemeral Disk Settings for the operating system disk used by the compute node (VM).",
"Properties": [
{
"Key": {
"Type": "Common.DiffDiskPlacement?",
"Name": "Placement",
"SummaryComment": "This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements.",
"RemarksComment": null,
"BoundAccess": "read,write",
"UnboundAccess": "read,write"
},
"Value": {
"Type": "Models.DiffDiskPlacement?",
"Name": "Placement"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"ProtocolName": "Models.ImageReference",
"SummaryComment": "A reference to an Azure Virtual Machines Marketplace Image or a custom Azure Virtual Machine Image. To get the list of all Azure Marketplace Image references verified by Azure Batch, see <see cref=\"PoolOperations.ListSupportedImages\"/>.",
"IsUsedInCollections": true,
"IsConstructorPublic": false,
"Properties": [
{
"Key": {
Expand Down Expand Up @@ -64,6 +63,17 @@
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "string",
"Name": "ExactVersion",
"SummaryComment": "The specific version of the platform image or marketplace image used to create the node. This read-only field differs from 'version' only if the value specified for 'version' when the pool was created was 'latest'.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read"
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"Name": "InstanceViewStatus",
"ProtocolName": "Models.InstanceViewStatus",
"SummaryComment": "The instance view status.",
"IsUsedInCollections": true,
"Properties": [
{
"Key": {
"Type": "string",
"Name": "Code",
"SummaryComment": "The status code.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "string",
"Name": "DisplayStatus",
"SummaryComment": "The localized label for the status.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "Common.StatusLevelTypes?",
"Name": "Level",
"SummaryComment": "Level code.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"HideSetter": true
},
"Value": {
"Type": "Models.StatusLevelTypes?",
"Name": "Level"
}
},
{
"Key": {
"Type": "string",
"Name": "Message",
"SummaryComment": "The detailed status message.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"HideSetter": true
},
"Value": null
},
{
"Key": {
"Type": "string",
"Name": "Time",
"SummaryComment": "The time of the status.",
"RemarksComment": null,
"BoundAccess": "read",
"UnboundAccess": "read,write",
"HideSetter": true
},
"Value": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"Type": "int?",
"Name": "RequiredSlots",
"SummaryComment": "The number of scheduling slots that the Task required to run.",
"RemarksComment": "The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this must be 1.",
"RemarksComment": "The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this property is not supported and must not be specified.",
"BoundAccess": "read",
"UnboundAccess": "read,write"
},
Expand Down
Loading