diff --git a/sdk/batch/Microsoft.Azure.Batch/CHANGELOG.md b/sdk/batch/Microsoft.Azure.Batch/CHANGELOG.md index dbd6c1349b29..22bf923955e1 100644 --- a/sdk/batch/Microsoft.Azure.Batch/CHANGELOG.md +++ b/sdk/batch/Microsoft.Azure.Batch/CHANGELOG.md @@ -1,16 +1,22 @@ # Release History -## 15.2.0-beta.1 (Unreleased) +## 15.3.0 (2022-01-07) ### Features Added -### Breaking Changes +- Added property `UploadHeaders` to `OutputFileBlobContainerDestination`. + - Allows users to set custom HTTP headers on resource file uploads. + - Array of type `HttpHeader` (also being added). +- Added boolean property `AllowTaskPreemption` to `JobSpecification`, `CloudJob`, `JobAddParameter`, `JobPatchParameter`, `JobUpdateParameter` + - Mark Tasks as preemptible for higher priority Tasks (requires Comms-Enabled or Single Tenant Pool). +- Replaced comment (title, description, etc.) references of "low-priority" with "Spot/Low-Priority", to reflect new service behavior. + - No API change required. + - Low-Priority Compute Nodes (VMs) will continue to be used for User Subscription pools (and only User Subscription pools), as before. + - Spot Compute Nodes (VMs) will now be used for Batch Managed (and only Batch Managed pools) pools. ### Bugs Fixed -### Other Changes - -## 15.2.0 (2021-08-10) +- Fixed OutputFileBlobContainerDestination constructor null reference exception. ## Features Added diff --git a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/CloudJob.json b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/CloudJob.json index bb52ccae9dc0..35f6f3c9c65c 100644 --- a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/CloudJob.json +++ b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/CloudJob.json @@ -300,6 +300,17 @@ "UnboundAccess": "read,write" }, "Value": null + }, + { + "Key": { + "Type": "bool?", + "Name": "AllowTaskPreemption", + "SummaryComment": "Whether Tasks in this job can be preempted by other high priority jobs.", + "RemarksComment": "If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.", + "BoundAccess": "read,write", + "UnboundAccess": "read,write" + }, + "Value": null } ] } diff --git a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/HttpHeader.json b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/HttpHeader.json new file mode 100644 index 000000000000..5edf4345c085 --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/HttpHeader.json @@ -0,0 +1,32 @@ +{ + "Name": "HttpHeader", + "ProtocolName": "Models.HttpHeader", + "SummaryComment": "An HTTP header name-value pair", + "IsUsedInCollections": true, + "Properties": [ + { + "Key": { + "Type": "string", + "Name": "Name", + "SummaryComment": "The case-insensitive name of the header to be used while uploading output files.", + "RemarksComment": null, + "BoundAccess": "read,write", + "UnboundAccess": "read,write", + "ConstructorArgumentType": "Required" + }, + "Value": null + }, + { + "Key": { + "Type": "string", + "Name": "Value", + "SummaryComment": "The value of the header to be used while uploading output files.", + "RemarksComment": null, + "BoundAccess": "read,write", + "UnboundAccess": "read,write", + "ConstructorArgumentType": "Required" + }, + "Value": null + } + ] +} diff --git a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/JobSpecification.json b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/JobSpecification.json index 702d5dd294f5..823933f5f772 100644 --- a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/JobSpecification.json +++ b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/JobSpecification.json @@ -172,6 +172,17 @@ "UnboundAccess": "read,write" }, "Value": null + }, + { + "Key": { + "Type": "bool?", + "Name": "AllowTaskPreemption", + "SummaryComment": "Whether Tasks in this job can be preempted by other high priority jobs.", + "RemarksComment": "If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.", + "BoundAccess": "read,write", + "UnboundAccess": "read,write" + }, + "Value": null } ] } diff --git a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/OutputFileBlobContainerDestination.json b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/OutputFileBlobContainerDestination.json index c7209b7016ee..3475bb037ba8 100644 --- a/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/OutputFileBlobContainerDestination.json +++ b/sdk/batch/Microsoft.Azure.Batch/Tools/ObjectModelCodeGenerator/Spec/OutputFileBlobContainerDestination.json @@ -40,6 +40,18 @@ "UnboundAccess": "read,write" }, "Value": null + }, + { + "Key": { + "Type": "IList", + "Name": "UploadHeaders", + "SummaryComment": "A list of name-value pairs for headers to be used in uploading output files.", + "RemarksComment": "These headers will be specified when uploading files to Azure Storage. For more information, see [Request Headers (All Blob Types)](https://docs.microsoft.com/rest/api/storageservices/put-blob#request-headers-all-blob-types).", + "BoundAccess": "read", + "UnboundAccess": "read,write", + "ConstructorArgumentType": "None" + }, + "Value": null } ] } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/CloudJob.cs b/sdk/batch/Microsoft.Azure.Batch/src/CloudJob.cs index 786d826e11ff..b0fad08db4d7 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/CloudJob.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/CloudJob.cs @@ -58,11 +58,13 @@ public async Task CommitAsync( Models.PoolInformation modelPoolInformation = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolInformation, item => item.GetTransportObject()); asyncTask = this.parentBatchClient.ProtocolLayer.UpdateJob( - this.Id, - this.Priority, + Id, + Priority, UtilitiesInternal.MapNullableEnum(this.OnAllTasksComplete), modelPoolInformation, modelJobConstraints, + MaxParallelTasks, + AllowTaskPreemption, modelMetadata, behaveMgr, cancellationToken); @@ -124,9 +126,10 @@ public async Task CommitChangesAsync( int? maxParallelTasks = this.propertyContainer.MaxParallelTasksProperty.GetIfChangedOrNull(); Task asyncTask = this.parentBatchClient.ProtocolLayer.PatchJob( - this.Id, + Id, priority, maxParallelTasks, + AllowTaskPreemption, UtilitiesInternal.MapNullableEnum(this.OnAllTasksComplete), modelPoolInformation, modelJobConstraints, diff --git a/sdk/batch/Microsoft.Azure.Batch/src/Generated/CloudJob.cs b/sdk/batch/Microsoft.Azure.Batch/src/Generated/CloudJob.cs index 58b16ebbc02a..795e09cadfc5 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/Generated/CloudJob.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/Generated/CloudJob.cs @@ -24,6 +24,7 @@ public partial class CloudJob : ITransportObjectProvider { private class PropertyContainer : PropertyCollection { + public readonly PropertyAccessor AllowTaskPreemptionProperty; public readonly PropertyAccessor> CommonEnvironmentSettingsProperty; public readonly PropertyAccessor ConstraintsProperty; public readonly PropertyAccessor CreationTimeProperty; @@ -52,6 +53,7 @@ private class PropertyContainer : PropertyCollection public PropertyContainer() : base(BindingState.Unbound) { + this.AllowTaskPreemptionProperty = this.CreatePropertyAccessor(nameof(AllowTaskPreemption), BindingAccess.Read | BindingAccess.Write); this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor>(nameof(CommonEnvironmentSettings), BindingAccess.Read | BindingAccess.Write); this.ConstraintsProperty = this.CreatePropertyAccessor(nameof(Constraints), BindingAccess.Read | BindingAccess.Write); this.CreationTimeProperty = this.CreatePropertyAccessor(nameof(CreationTime), BindingAccess.None); @@ -81,6 +83,10 @@ public PropertyContainer() : base(BindingState.Unbound) public PropertyContainer(Models.CloudJob protocolObject) : base(BindingState.Bound) { + this.AllowTaskPreemptionProperty = this.CreatePropertyAccessor( + protocolObject.AllowTaskPreemption, + nameof(AllowTaskPreemption), + BindingAccess.Read | BindingAccess.Write); this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor( EnvironmentSetting.ConvertFromProtocolCollectionAndFreeze(protocolObject.CommonEnvironmentSettings), nameof(CommonEnvironmentSettings), @@ -240,6 +246,20 @@ internal CloudJob( #region CloudJob + /// + /// Gets or sets whether Tasks in this job can be preempted by other high priority jobs. + /// + /// + /// If the value is set to True, other high priority jobs submitted to the system will take precedence and will be + /// able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using + /// the update job API. + /// + public bool? AllowTaskPreemption + { + get { return this.propertyContainer.AllowTaskPreemptionProperty.Value; } + set { this.propertyContainer.AllowTaskPreemptionProperty.Value = value; } + } + /// /// Gets or sets a list of common environment variable settings. These environment variables are set for all tasks /// in this (including the Job Manager, Job Preparation and Job Release tasks). @@ -528,6 +548,7 @@ bool IReadOnly.IsReadOnly { Models.JobAddParameter result = new Models.JobAddParameter() { + AllowTaskPreemption = this.AllowTaskPreemption, CommonEnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.CommonEnvironmentSettings), Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject()), DisplayName = this.DisplayName, diff --git a/sdk/batch/Microsoft.Azure.Batch/src/Generated/HttpHeader.cs b/sdk/batch/Microsoft.Azure.Batch/src/Generated/HttpHeader.cs new file mode 100644 index 000000000000..0d0cb158cc64 --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Batch/src/Generated/HttpHeader.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// +// This file was autogenerated by a tool. +// Do not modify it. +// + +namespace Microsoft.Azure.Batch +{ + using Models = Microsoft.Azure.Batch.Protocol.Models; + using System; + using System.Collections.Generic; + using System.Linq; + + /// + /// An HTTP header name-value pair + /// + public partial class HttpHeader : ITransportObjectProvider, IPropertyMetadata + { + private class PropertyContainer : PropertyCollection + { + public readonly PropertyAccessor NameProperty; + public readonly PropertyAccessor ValueProperty; + + public PropertyContainer() : base(BindingState.Unbound) + { + this.NameProperty = this.CreatePropertyAccessor(nameof(Name), BindingAccess.Read | BindingAccess.Write); + this.ValueProperty = this.CreatePropertyAccessor(nameof(Value), BindingAccess.Read | BindingAccess.Write); + } + + public PropertyContainer(Models.HttpHeader protocolObject) : base(BindingState.Bound) + { + this.NameProperty = this.CreatePropertyAccessor( + protocolObject.Name, + nameof(Name), + BindingAccess.Read | BindingAccess.Write); + this.ValueProperty = this.CreatePropertyAccessor( + protocolObject.Value, + nameof(Value), + BindingAccess.Read | BindingAccess.Write); + } + } + + private readonly PropertyContainer propertyContainer; + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The case-insensitive name of the header to be used while uploading output files. + /// The value of the header to be used while uploading output files. + public HttpHeader( + string name, + string value) + { + this.propertyContainer = new PropertyContainer(); + this.Name = name; + this.Value = value; + } + + /// + /// Default constructor to support mocking the class. + /// + protected HttpHeader() + { + this.propertyContainer = new PropertyContainer(); + } + + internal HttpHeader(Models.HttpHeader protocolObject) + { + this.propertyContainer = new PropertyContainer(protocolObject); + } + + #endregion Constructors + + #region HttpHeader + + /// + /// Gets or sets the case-insensitive name of the header to be used while uploading output files. + /// + public string Name + { + get { return this.propertyContainer.NameProperty.Value; } + set { this.propertyContainer.NameProperty.Value = value; } + } + + /// + /// Gets or sets the value of the header to be used while uploading output files. + /// + public string Value + { + get { return this.propertyContainer.ValueProperty.Value; } + set { this.propertyContainer.ValueProperty.Value = value; } + } + + #endregion // HttpHeader + + #region IPropertyMetadata + + bool IModifiable.HasBeenModified + { + get { return this.propertyContainer.HasBeenModified; } + } + + bool IReadOnly.IsReadOnly + { + get { return this.propertyContainer.IsReadOnly; } + set { this.propertyContainer.IsReadOnly = value; } + } + + #endregion //IPropertyMetadata + + #region Internal/private methods + /// + /// Return a protocol object of the requested type. + /// + /// The protocol object of the requested type. + Models.HttpHeader ITransportObjectProvider.GetTransportObject() + { + Models.HttpHeader result = new Models.HttpHeader() + { + Name = this.Name, + Value = this.Value, + }; + + return result; + } + + /// + /// Converts a collection of protocol layer objects to object layer collection objects. + /// + internal static IList ConvertFromProtocolCollection(IEnumerable protoCollection) + { + ConcurrentChangeTrackedModifiableList converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable( + items: protoCollection, + objectCreationFunc: o => new HttpHeader(o)); + + return converted; + } + + /// + /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. + /// + internal static IList ConvertFromProtocolCollectionAndFreeze(IEnumerable protoCollection) + { + ConcurrentChangeTrackedModifiableList converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable( + items: protoCollection, + objectCreationFunc: o => new HttpHeader(o).Freeze()); + + converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); + + return converted; + } + + /// + /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked readonly + /// and returned as a readonly collection. + /// + internal static IReadOnlyList ConvertFromProtocolCollectionReadOnly(IEnumerable protoCollection) + { + IReadOnlyList converted = + UtilitiesInternal.CreateObjectWithNullCheck( + UtilitiesInternal.CollectionToNonThreadSafeCollection( + items: protoCollection, + objectCreationFunc: o => new HttpHeader(o).Freeze()), o => o.AsReadOnly()); + + return converted; + } + + #endregion // Internal/private methods + } +} \ No newline at end of file diff --git a/sdk/batch/Microsoft.Azure.Batch/src/Generated/JobSpecification.cs b/sdk/batch/Microsoft.Azure.Batch/src/Generated/JobSpecification.cs index 2e454b646679..f2cb9bf56a57 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/Generated/JobSpecification.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/Generated/JobSpecification.cs @@ -24,6 +24,7 @@ public partial class JobSpecification : ITransportObjectProvider AllowTaskPreemptionProperty; public readonly PropertyAccessor> CommonEnvironmentSettingsProperty; public readonly PropertyAccessor ConstraintsProperty; public readonly PropertyAccessor DisplayNameProperty; @@ -41,6 +42,7 @@ private class PropertyContainer : PropertyCollection public PropertyContainer() : base(BindingState.Unbound) { + this.AllowTaskPreemptionProperty = this.CreatePropertyAccessor(nameof(AllowTaskPreemption), BindingAccess.Read | BindingAccess.Write); this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor>(nameof(CommonEnvironmentSettings), BindingAccess.Read | BindingAccess.Write); this.ConstraintsProperty = this.CreatePropertyAccessor(nameof(Constraints), BindingAccess.Read | BindingAccess.Write); this.DisplayNameProperty = this.CreatePropertyAccessor(nameof(DisplayName), BindingAccess.Read | BindingAccess.Write); @@ -59,6 +61,10 @@ public PropertyContainer() : base(BindingState.Unbound) public PropertyContainer(Models.JobSpecification protocolObject) : base(BindingState.Bound) { + this.AllowTaskPreemptionProperty = this.CreatePropertyAccessor( + protocolObject.AllowTaskPreemption, + nameof(AllowTaskPreemption), + BindingAccess.Read | BindingAccess.Write); this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor( EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.CommonEnvironmentSettings), nameof(CommonEnvironmentSettings), @@ -142,6 +148,20 @@ internal JobSpecification(Models.JobSpecification protocolObject) #region JobSpecification + /// + /// Gets or sets whether Tasks in this job can be preempted by other high priority jobs. + /// + /// + /// If the value is set to True, other high priority jobs submitted to the system will take precedence and will be + /// able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using + /// the update job API. + /// + public bool? AllowTaskPreemption + { + get { return this.propertyContainer.AllowTaskPreemptionProperty.Value; } + set { this.propertyContainer.AllowTaskPreemptionProperty.Value = value; } + } + /// /// Gets or sets a list of common environment variable settings. /// @@ -331,6 +351,7 @@ bool IReadOnly.IsReadOnly { Models.JobSpecification result = new Models.JobSpecification() { + AllowTaskPreemption = this.AllowTaskPreemption, CommonEnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.CommonEnvironmentSettings), Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject()), DisplayName = this.DisplayName, diff --git a/sdk/batch/Microsoft.Azure.Batch/src/Generated/OutputFileBlobContainerDestination.cs b/sdk/batch/Microsoft.Azure.Batch/src/Generated/OutputFileBlobContainerDestination.cs index 6a2361f704a5..66bae621daba 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/Generated/OutputFileBlobContainerDestination.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/Generated/OutputFileBlobContainerDestination.cs @@ -27,12 +27,14 @@ private class PropertyContainer : PropertyCollection public readonly PropertyAccessor ContainerUrlProperty; public readonly PropertyAccessor IdentityReferenceProperty; public readonly PropertyAccessor PathProperty; + public readonly PropertyAccessor> UploadHeadersProperty; public PropertyContainer() : base(BindingState.Unbound) { this.ContainerUrlProperty = this.CreatePropertyAccessor(nameof(ContainerUrl), BindingAccess.Read | BindingAccess.Write); this.IdentityReferenceProperty = this.CreatePropertyAccessor(nameof(IdentityReference), BindingAccess.Read | BindingAccess.Write); this.PathProperty = this.CreatePropertyAccessor(nameof(Path), BindingAccess.Read | BindingAccess.Write); + this.UploadHeadersProperty = this.CreatePropertyAccessor>(nameof(UploadHeaders), BindingAccess.Read | BindingAccess.Write); } public PropertyContainer(Models.OutputFileBlobContainerDestination protocolObject) : base(BindingState.Bound) @@ -49,6 +51,10 @@ public PropertyContainer(Models.OutputFileBlobContainerDestination protocolObjec protocolObject.Path, nameof(Path), BindingAccess.Read); + this.UploadHeadersProperty = this.CreatePropertyAccessor( + HttpHeader.ConvertFromProtocolCollectionAndFreeze(protocolObject.UploadHeaders), + nameof(UploadHeaders), + BindingAccess.Read); } } @@ -127,6 +133,22 @@ public string Path private set { this.propertyContainer.PathProperty.Value = value; } } + /// + /// Gets or sets a list of name-value pairs for headers to be used in uploading output files. + /// + /// + /// These headers will be specified when uploading files to Azure Storage. For more information, see [Request Headers + /// (All Blob Types)](https://docs.microsoft.com/rest/api/storageservices/put-blob#request-headers-all-blob-types). + /// + public IList UploadHeaders + { + get { return this.propertyContainer.UploadHeadersProperty.Value; } + set + { + this.propertyContainer.UploadHeadersProperty.Value = ConcurrentChangeTrackedModifiableList.TransformEnumerableToConcurrentModifiableList(value); + } + } + #endregion // OutputFileBlobContainerDestination #region IPropertyMetadata @@ -156,6 +178,7 @@ bool IReadOnly.IsReadOnly ContainerUrl = this.ContainerUrl, IdentityReference = UtilitiesInternal.CreateObjectWithNullCheck(this.IdentityReference, (o) => o.GetTransportObject()), Path = this.Path, + UploadHeaders = UtilitiesInternal.ConvertToProtocolCollection(this.UploadHeaders), }; return result; diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/BatchServiceClient.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/BatchServiceClient.cs index d4c2e009860d..d052d20414ca 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/BatchServiceClient.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/BatchServiceClient.cs @@ -262,7 +262,7 @@ private void Initialize() ComputeNode = new ComputeNodeOperations(this); ComputeNodeExtension = new ComputeNodeExtensionOperations(this); BaseUri = "{batchUrl}"; - ApiVersion = "2021-06-01.14.0"; + ApiVersion = "2022-01-01.15.0"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJob.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJob.cs index 990947900750..ee55318639bf 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJob.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJob.cs @@ -48,6 +48,8 @@ public CloudJob() /// The time at which the Job /// entered its previous state. /// The priority of the Job. + /// Whether Tasks in this job can be + /// preempted by other high priority jobs /// The maximum number of tasks that can /// be executed in parallel for the job. /// The execution constraints for the @@ -75,7 +77,7 @@ public CloudJob() /// Job. /// Resource usage statistics for the entire /// lifetime of the Job. - public CloudJob(string id = default(string), string displayName = default(string), bool? usesTaskDependencies = default(bool?), string url = default(string), string eTag = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), JobState? state = default(JobState?), System.DateTime? stateTransitionTime = default(System.DateTime?), JobState? previousState = default(JobState?), System.DateTime? previousStateTransitionTime = default(System.DateTime?), int? priority = default(int?), int? maxParallelTasks = default(int?), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), PoolInformation poolInfo = default(PoolInformation), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration), IList metadata = default(IList), JobExecutionInformation executionInfo = default(JobExecutionInformation), JobStatistics stats = default(JobStatistics)) + public CloudJob(string id = default(string), string displayName = default(string), bool? usesTaskDependencies = default(bool?), string url = default(string), string eTag = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), JobState? state = default(JobState?), System.DateTime? stateTransitionTime = default(System.DateTime?), JobState? previousState = default(JobState?), System.DateTime? previousStateTransitionTime = default(System.DateTime?), int? priority = default(int?), bool? allowTaskPreemption = default(bool?), int? maxParallelTasks = default(int?), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), PoolInformation poolInfo = default(PoolInformation), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration), IList metadata = default(IList), JobExecutionInformation executionInfo = default(JobExecutionInformation), JobStatistics stats = default(JobStatistics)) { Id = id; DisplayName = displayName; @@ -89,6 +91,7 @@ public CloudJob() PreviousState = previousState; PreviousStateTransitionTime = previousStateTransitionTime; Priority = priority; + AllowTaskPreemption = allowTaskPreemption; MaxParallelTasks = maxParallelTasks; Constraints = constraints; JobManagerTask = jobManagerTask; @@ -216,6 +219,19 @@ public CloudJob() [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } + /// + /// Gets or sets whether Tasks in this job can be preempted by other + /// high priority jobs + /// + /// + /// If the value is set to True, other high priority jobs submitted to + /// the system will take precedence and will be able requeue tasks from + /// this job. You can update a job's allowTaskPreemption after it has + /// been created using the update job API. + /// + [JsonProperty(PropertyName = "allowTaskPreemption")] + public bool? AllowTaskPreemption { get; set; } + /// /// Gets or sets the maximum number of tasks that can be executed in /// parallel for the job. diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJobSchedule.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJobSchedule.cs index 39db9a24bf79..53ce0dde7a1a 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJobSchedule.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudJobSchedule.cs @@ -178,6 +178,10 @@ public CloudJobSchedule() /// /// Gets or sets the schedule according to which Jobs will be created. /// + /// + /// All times are fixed respective to UTC and are not impacted by + /// daylight saving time. + /// [JsonProperty(PropertyName = "schedule")] public Schedule Schedule { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudPool.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudPool.cs index 91eec9334f14..c6c1f372070b 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudPool.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/CloudPool.cs @@ -57,12 +57,12 @@ public CloudPool() /// performing the last resize on the Pool. /// The number of dedicated Compute /// Nodes currently in the Pool. - /// The number of low-priority - /// Compute Nodes currently in the Pool. + /// The number of + /// Spot/Low-priority Compute Nodes currently in the Pool. /// The desired number of dedicated /// Compute Nodes in the Pool. /// The desired number of - /// low-priority Compute Nodes in the Pool. + /// Spot/Low-priority Compute Nodes in the Pool. /// Whether the Pool size should /// automatically adjust over time. /// A formula for the desired number of @@ -302,12 +302,12 @@ public CloudPool() public int? CurrentDedicatedNodes { get; set; } /// - /// Gets or sets the number of low-priority Compute Nodes currently in - /// the Pool. + /// Gets or sets the number of Spot/Low-priority Compute Nodes + /// currently in the Pool. /// /// - /// low-priority Compute Nodes which have been preempted are included - /// in this count. + /// Spot/Low-priority Compute Nodes which have been preempted are + /// included in this count. /// [JsonProperty(PropertyName = "currentLowPriorityNodes")] public int? CurrentLowPriorityNodes { get; set; } @@ -320,8 +320,8 @@ public CloudPool() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority Compute Nodes in - /// the Pool. + /// Gets or sets the desired number of Spot/Low-priority Compute Nodes + /// in the Pool. /// [JsonProperty(PropertyName = "targetLowPriorityNodes")] public int? TargetLowPriorityNodes { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNode.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNode.cs index ba7921499592..ee888993e8eb 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNode.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNode.cs @@ -75,8 +75,8 @@ public ComputeNode() /// The list of errors that are currently being /// encountered by the Compute Node. /// Whether this Compute Node is a dedicated - /// Compute Node. If false, the Compute Node is a low-priority Compute - /// Node. + /// Compute Node. If false, the Compute Node is a Spot/Low-priority + /// Compute Node. /// The endpoint configuration for /// the Compute Node. /// Information about the Compute Node @@ -139,8 +139,8 @@ public ComputeNode() /// Gets or sets the current state of the Compute Node. /// /// - /// The low-priority Compute Node has been preempted. Tasks which were - /// running on the Compute Node when it was preempted will be + /// The Spot/Low-priority Compute Node has been preempted. Tasks which + /// were running on the Compute Node when it was preempted will be /// rescheduled when another Compute Node becomes available. Possible /// values include: 'idle', 'rebooting', 'reimaging', 'running', /// 'unusable', 'creating', 'starting', 'waitingForStartTask', @@ -310,7 +310,7 @@ public ComputeNode() /// /// Gets or sets whether this Compute Node is a dedicated Compute Node. - /// If false, the Compute Node is a low-priority Compute Node. + /// If false, the Compute Node is a Spot/Low-priority Compute Node. /// [JsonProperty(PropertyName = "isDedicated")] public bool? IsDedicated { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNodeState.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNodeState.cs index 8193ecbcf0fa..46c1840d702d 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNodeState.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/ComputeNodeState.cs @@ -91,8 +91,8 @@ public enum ComputeNodeState [EnumMember(Value = "offline")] Offline, /// - /// The low-priority Compute Node has been preempted. Tasks which were - /// running on the Compute Node when it was preempted will be + /// The Spot/Low-priority Compute Node has been preempted. Tasks which + /// were running on the Compute Node when it was preempted will be /// rescheduled when another Compute Node becomes available. /// [EnumMember(Value = "preempted")] diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/HttpHeader.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/HttpHeader.cs new file mode 100644 index 000000000000..718da63bcb45 --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/HttpHeader.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Batch.Protocol.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An HTTP header name-value pair + /// + public partial class HttpHeader + { + /// + /// Initializes a new instance of the HttpHeader class. + /// + public HttpHeader() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpHeader class. + /// + /// The case-insensitive name of the header to be + /// used while uploading output files + /// The value of the header to be used while + /// uploading output files + public HttpHeader(string name, string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the case-insensitive name of the header to be used + /// while uploading output files + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the header to be used while uploading + /// output files + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobAddParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobAddParameter.cs index a68ca00e8534..01ceea689676 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobAddParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobAddParameter.cs @@ -40,6 +40,8 @@ public JobAddParameter() /// The priority of the Job. /// The maximum number of tasks that can /// be executed in parallel for the job. + /// Whether Tasks in this job can be + /// preempted by other high priority jobs /// The execution constraints for the /// Job. /// Details of a Job Manager Task to be @@ -61,12 +63,13 @@ public JobAddParameter() /// define dependencies on each other. The default is false. /// The network configuration for /// the Job. - public JobAddParameter(string id, PoolInformation poolInfo, string displayName = default(string), int? priority = default(int?), int? maxParallelTasks = default(int?), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), IList metadata = default(IList), bool? usesTaskDependencies = default(bool?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration)) + public JobAddParameter(string id, PoolInformation poolInfo, string displayName = default(string), int? priority = default(int?), int? maxParallelTasks = default(int?), bool? allowTaskPreemption = default(bool?), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), IList metadata = default(IList), bool? usesTaskDependencies = default(bool?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration)) { Id = id; DisplayName = displayName; Priority = priority; MaxParallelTasks = maxParallelTasks; + AllowTaskPreemption = allowTaskPreemption; Constraints = constraints; JobManagerTask = jobManagerTask; JobPreparationTask = jobPreparationTask; @@ -135,6 +138,19 @@ public JobAddParameter() [JsonProperty(PropertyName = "maxParallelTasks")] public int? MaxParallelTasks { get; set; } + /// + /// Gets or sets whether Tasks in this job can be preempted by other + /// high priority jobs + /// + /// + /// If the value is set to True, other high priority jobs submitted to + /// the system will take precedence and will be able requeue tasks from + /// this job. You can update a job's allowTaskPreemption after it has + /// been created using the update job API. + /// + [JsonProperty(PropertyName = "allowTaskPreemption")] + public bool? AllowTaskPreemption { get; set; } + /// /// Gets or sets the execution constraints for the Job. /// diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobManagerTask.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobManagerTask.cs index 01f28b15d9a1..c36f7767e65a 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobManagerTask.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobManagerTask.cs @@ -90,7 +90,7 @@ public JobManagerTask() /// authentication token that the Task can use to perform Batch service /// operations. /// Whether the Job Manager Task may - /// run on a low-priority Compute Node. + /// run on a Spot/Low-priority Compute Node. public JobManagerTask(string id, string commandLine, string displayName = default(string), TaskContainerSettings containerSettings = default(TaskContainerSettings), IList resourceFiles = default(IList), IList outputFiles = default(IList), IList environmentSettings = default(IList), TaskConstraints constraints = default(TaskConstraints), int? requiredSlots = default(int?), bool? killJobOnCompletion = default(bool?), UserIdentity userIdentity = default(UserIdentity), bool? runExclusive = default(bool?), IList applicationPackageReferences = default(IList), AuthenticationTokenSettings authenticationTokenSettings = default(AuthenticationTokenSettings), bool? allowLowPriorityNode = default(bool?)) { Id = id; @@ -310,8 +310,8 @@ public JobManagerTask() public AuthenticationTokenSettings AuthenticationTokenSettings { get; set; } /// - /// Gets or sets whether the Job Manager Task may run on a low-priority - /// Compute Node. + /// Gets or sets whether the Job Manager Task may run on a + /// Spot/Low-priority Compute Node. /// /// /// The default value is true. diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobPatchParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobPatchParameter.cs index ecf8083b5e3f..9339a05ed55b 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobPatchParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobPatchParameter.cs @@ -34,6 +34,8 @@ public JobPatchParameter() /// The priority of the Job. /// The maximum number of tasks that can /// be executed in parallel for the job. + /// Whether Tasks in this job can be + /// preempted by other high priority jobs /// The action the Batch service /// should take when all Tasks in the Job are in the completed /// state. @@ -43,10 +45,11 @@ public JobPatchParameter() /// Job's Tasks. /// A list of name-value pairs associated with /// the Job as metadata. - public JobPatchParameter(int? priority = default(int?), int? maxParallelTasks = default(int?), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), JobConstraints constraints = default(JobConstraints), PoolInformation poolInfo = default(PoolInformation), IList metadata = default(IList)) + public JobPatchParameter(int? priority = default(int?), int? maxParallelTasks = default(int?), bool? allowTaskPreemption = default(bool?), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), JobConstraints constraints = default(JobConstraints), PoolInformation poolInfo = default(PoolInformation), IList metadata = default(IList)) { Priority = priority; MaxParallelTasks = maxParallelTasks; + AllowTaskPreemption = allowTaskPreemption; OnAllTasksComplete = onAllTasksComplete; Constraints = constraints; PoolInfo = poolInfo; @@ -84,6 +87,19 @@ public JobPatchParameter() [JsonProperty(PropertyName = "maxParallelTasks")] public int? MaxParallelTasks { get; set; } + /// + /// Gets or sets whether Tasks in this job can be preempted by other + /// high priority jobs + /// + /// + /// If the value is set to True, other high priority jobs submitted to + /// the system will take precedence and will be able requeue tasks from + /// this job. You can update a job's allowTaskPreemption after it has + /// been created using the update job API. + /// + [JsonProperty(PropertyName = "allowTaskPreemption")] + public bool? AllowTaskPreemption { get; set; } + /// /// Gets or sets the action the Batch service should take when all /// Tasks in the Job are in the completed state. diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleAddParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleAddParameter.cs index 7c2dfbd17b71..7442364790ad 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleAddParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleAddParameter.cs @@ -85,6 +85,10 @@ public JobScheduleAddParameter() /// /// Gets or sets the schedule according to which Jobs will be created. /// + /// + /// All times are fixed respective to UTC and are not impacted by + /// daylight saving time. + /// [JsonProperty(PropertyName = "schedule")] public Schedule Schedule { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSchedulePatchParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSchedulePatchParameter.cs index 93b76824dbb4..fcda4fdf9887 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSchedulePatchParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSchedulePatchParameter.cs @@ -54,8 +54,9 @@ public JobSchedulePatchParameter() /// Gets or sets the schedule according to which Jobs will be created. /// /// - /// If you do not specify this element, the existing schedule is left - /// unchanged. + /// All times are fixed respective to UTC and are not impacted by + /// daylight saving time. If you do not specify this element, the + /// existing schedule is left unchanged. /// [JsonProperty(PropertyName = "schedule")] public Schedule Schedule { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs index 1a15341cefd7..e0268dca8343 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs @@ -55,9 +55,10 @@ public JobScheduleUpdateParameter() /// Gets or sets the schedule according to which Jobs will be created. /// /// - /// If you do not specify this element, it is equivalent to passing the - /// default schedule: that is, a single Job scheduled to run - /// immediately. + /// All times are fixed respective to UTC and are not impacted by + /// daylight saving time. If you do not specify this element, it is + /// equivalent to passing the default schedule: that is, a single Job + /// scheduled to run immediately. /// [JsonProperty(PropertyName = "schedule")] public Schedule Schedule { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSpecification.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSpecification.cs index 48ee2fb9c77b..5b20e2288bc2 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSpecification.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobSpecification.cs @@ -36,6 +36,8 @@ public JobSpecification() /// Tasks of Jobs created under this schedule. /// The priority of Jobs created under this /// schedule. + /// Whether Tasks in this job can be + /// preempted by other high priority jobs /// The maximum number of tasks that can /// be executed in parallel for the job. /// The display name for Jobs created under @@ -68,9 +70,10 @@ public JobSpecification() /// Job Manager, Job Preparation and Job Release Tasks). /// A list of name-value pairs associated with /// each Job created under this schedule as metadata. - public JobSpecification(PoolInformation poolInfo, int? priority = default(int?), int? maxParallelTasks = default(int?), string displayName = default(string), bool? usesTaskDependencies = default(bool?), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), IList metadata = default(IList)) + public JobSpecification(PoolInformation poolInfo, int? priority = default(int?), bool? allowTaskPreemption = default(bool?), int? maxParallelTasks = default(int?), string displayName = default(string), bool? usesTaskDependencies = default(bool?), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?), OnTaskFailure? onTaskFailure = default(OnTaskFailure?), JobNetworkConfiguration networkConfiguration = default(JobNetworkConfiguration), JobConstraints constraints = default(JobConstraints), JobManagerTask jobManagerTask = default(JobManagerTask), JobPreparationTask jobPreparationTask = default(JobPreparationTask), JobReleaseTask jobReleaseTask = default(JobReleaseTask), IList commonEnvironmentSettings = default(IList), IList metadata = default(IList)) { Priority = priority; + AllowTaskPreemption = allowTaskPreemption; MaxParallelTasks = maxParallelTasks; DisplayName = displayName; UsesTaskDependencies = usesTaskDependencies; @@ -105,6 +108,19 @@ public JobSpecification() [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } + /// + /// Gets or sets whether Tasks in this job can be preempted by other + /// high priority jobs + /// + /// + /// If the value is set to True, other high priority jobs submitted to + /// the system will take precedence and will be able requeue tasks from + /// this job. You can update a job's allowTaskPreemption after it has + /// been created using the update job API. + /// + [JsonProperty(PropertyName = "allowTaskPreemption")] + public bool? AllowTaskPreemption { get; set; } + /// /// Gets or sets the maximum number of tasks that can be executed in /// parallel for the job. diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobUpdateParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobUpdateParameter.cs index 6ba1f96c29a6..bd2603e7d098 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobUpdateParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/JobUpdateParameter.cs @@ -35,6 +35,10 @@ public JobUpdateParameter() /// The Pool on which the Batch service runs the /// Job's Tasks. /// The priority of the Job. + /// The maximum number of tasks that can + /// be executed in parallel for the job. + /// Whether Tasks in this job can be + /// preempted by other high priority jobs /// The execution constraints for the /// Job. /// A list of name-value pairs associated with @@ -42,9 +46,11 @@ public JobUpdateParameter() /// The action the Batch service /// should take when all Tasks in the Job are in the completed /// state. - public JobUpdateParameter(PoolInformation poolInfo, int? priority = default(int?), JobConstraints constraints = default(JobConstraints), IList metadata = default(IList), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?)) + public JobUpdateParameter(PoolInformation poolInfo, int? priority = default(int?), int? maxParallelTasks = default(int?), bool? allowTaskPreemption = default(bool?), JobConstraints constraints = default(JobConstraints), IList metadata = default(IList), OnAllTasksComplete? onAllTasksComplete = default(OnAllTasksComplete?)) { Priority = priority; + MaxParallelTasks = maxParallelTasks; + AllowTaskPreemption = allowTaskPreemption; Constraints = constraints; PoolInfo = poolInfo; Metadata = metadata; @@ -68,6 +74,33 @@ public JobUpdateParameter() [JsonProperty(PropertyName = "priority")] public int? Priority { get; set; } + /// + /// Gets or sets the maximum number of tasks that can be executed in + /// parallel for the job. + /// + /// + /// 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. + /// + [JsonProperty(PropertyName = "maxParallelTasks")] + public int? MaxParallelTasks { get; set; } + + /// + /// Gets or sets whether Tasks in this job can be preempted by other + /// high priority jobs + /// + /// + /// If the value is set to True, other high priority jobs submitted to + /// the system will take precedence and will be able requeue tasks from + /// this job. You can update a job's allowTaskPreemption after it has + /// been created using the update job API. + /// + [JsonProperty(PropertyName = "allowTaskPreemption")] + public bool? AllowTaskPreemption { get; set; } + /// /// Gets or sets the execution constraints for the Job. /// diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs index 4c97a26109b8..134b86c99485 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Batch.Protocol.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -39,11 +41,14 @@ public OutputFileBlobContainerDestination() /// The reference to the user assigned /// identity to use to access Azure Blob Storage specified by /// containerUrl - public OutputFileBlobContainerDestination(string containerUrl, string path = default(string), ComputeNodeIdentityReference identityReference = default(ComputeNodeIdentityReference)) + /// A list of name-value pairs for headers + /// to be used in uploading output files + public OutputFileBlobContainerDestination(string containerUrl, string path = default(string), ComputeNodeIdentityReference identityReference = default(ComputeNodeIdentityReference), IList uploadHeaders = default(IList)) { Path = path; ContainerUrl = containerUrl; IdentityReference = identityReference; + UploadHeaders = uploadHeaders; CustomInit(); } @@ -91,5 +96,17 @@ public OutputFileBlobContainerDestination() [JsonProperty(PropertyName = "identityReference")] public ComputeNodeIdentityReference IdentityReference { get; set; } + /// + /// Gets or sets a list of name-value pairs for headers to be used in + /// uploading output files + /// + /// + /// These headers will be specified when uploading files to Azure + /// Storage. For more information, see [Request Headers (All Blob + /// Types)](https://docs.microsoft.com/rest/api/storageservices/put-blob#request-headers-all-blob-types). + /// + [JsonProperty(PropertyName = "uploadHeaders")] + public IList UploadHeaders { get; set; } + } } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolAddParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolAddParameter.cs index f3ed7d9917f3..9e3231c8c955 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolAddParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolAddParameter.cs @@ -45,7 +45,7 @@ public PoolAddParameter() /// The desired number of dedicated /// Compute Nodes in the Pool. /// The desired number of - /// low-priority Compute Nodes in the Pool. + /// Spot/Low-priority Compute Nodes in the Pool. /// Whether the Pool size should /// automatically adjust over time. /// A formula for the desired number of @@ -205,8 +205,8 @@ public PoolAddParameter() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority Compute Nodes in - /// the Pool. + /// Gets or sets the desired number of Spot/Low-priority Compute Nodes + /// in the Pool. /// /// /// This property must not be specified if enableAutoScale is set to diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolNodeCounts.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolNodeCounts.cs index 5374d6c01a86..ecc38318d234 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolNodeCounts.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolNodeCounts.cs @@ -32,8 +32,8 @@ public PoolNodeCounts() /// The ID of the Pool. /// The number of dedicated Compute Nodes in /// each state. - /// The number of low-priority Compute Nodes - /// in each state. + /// The number of Spot/Low-priority Compute + /// Nodes in each state. public PoolNodeCounts(string poolId, NodeCounts dedicated = default(NodeCounts), NodeCounts lowPriority = default(NodeCounts)) { PoolId = poolId; @@ -60,7 +60,7 @@ public PoolNodeCounts() public NodeCounts Dedicated { get; set; } /// - /// Gets or sets the number of low-priority Compute Nodes in each + /// Gets or sets the number of Spot/Low-priority Compute Nodes in each /// state. /// [JsonProperty(PropertyName = "lowPriority")] diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolResizeParameter.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolResizeParameter.cs index 0ad802b8a90e..b2017e2212d3 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolResizeParameter.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolResizeParameter.cs @@ -32,7 +32,7 @@ public PoolResizeParameter() /// The desired number of dedicated /// Compute Nodes in the Pool. /// The desired number of - /// low-priority Compute Nodes in the Pool. + /// Spot/Low-priority Compute Nodes in the Pool. /// The timeout for allocation of Nodes to /// the Pool or removal of Compute Nodes from the Pool. /// Determines what to do with a @@ -60,8 +60,8 @@ public PoolResizeParameter() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority Compute Nodes in - /// the Pool. + /// Gets or sets the desired number of Spot/Low-priority Compute Nodes + /// in the Pool. /// [JsonProperty(PropertyName = "targetLowPriorityNodes")] public int? TargetLowPriorityNodes { get; set; } diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolSpecification.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolSpecification.cs index 0d9a7e81c9ce..1647f7e4fe86 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolSpecification.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PoolSpecification.cs @@ -48,7 +48,7 @@ public PoolSpecification() /// The desired number of dedicated /// Compute Nodes in the Pool. /// The desired number of - /// low-priority Compute Nodes in the Pool. + /// Spot/Low-priority Compute Nodes in the Pool. /// Whether the Pool size should /// automatically adjust over time. /// The formula for the desired number @@ -208,8 +208,8 @@ public PoolSpecification() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority Compute Nodes in - /// the Pool. + /// Gets or sets the desired number of Spot/Low-priority Compute Nodes + /// in the Pool. /// /// /// This property must not be specified if enableAutoScale is set to diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PublicIPAddressConfiguration.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PublicIPAddressConfiguration.cs index fb7a9973ff4e..8f8864045c7c 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PublicIPAddressConfiguration.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/PublicIPAddressConfiguration.cs @@ -67,7 +67,7 @@ public PublicIPAddressConfiguration() /// /// /// The number of IPs specified here limits the maximum size of the - /// Pool - 100 dedicated nodes or 100 low-priority nodes can be + /// Pool - 100 dedicated nodes or 100 Spot/Low-priority nodes can be /// allocated for each public IP. For example, a pool needing 250 /// dedicated VMs would need at least 3 public IPs specified. Each /// element of this collection is of the form: diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/Schedule.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/Schedule.cs index afec677f64d8..6a127779997a 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/Schedule.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/Models/Schedule.cs @@ -14,7 +14,8 @@ namespace Microsoft.Azure.Batch.Protocol.Models using System.Linq; /// - /// The schedule according to which Jobs will be created + /// The schedule according to which Jobs will be created. All times are + /// fixed respective to UTC and are not impacted by daylight saving time. /// public partial class Schedule { diff --git a/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/SdkInfo_BatchServiceClient.cs b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/SdkInfo_BatchServiceClient.cs new file mode 100644 index 000000000000..c7114774b778 --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Batch/src/GeneratedProtocol/SdkInfo_BatchServiceClient.cs @@ -0,0 +1,36 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Batch.Protocol +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_BatchServiceClient + { + get + { + return new Tuple[] + { + new Tuple("BatchServiceClient", "Account", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "Application", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "Certificate", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "ComputeNode", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "ComputeNodeExtension", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "File", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "Job", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "JobSchedule", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "Pool", "2022-01-01.15.0"), + new Tuple("BatchServiceClient", "Task", "2022-01-01.15.0"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/batch/Microsoft.Azure.Batch/src/IProtocolLayer.cs b/sdk/batch/Microsoft.Azure.Batch/src/IProtocolLayer.cs index 52eeb8b08b72..142c1d8fc876 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/IProtocolLayer.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/IProtocolLayer.cs @@ -71,6 +71,7 @@ internal interface IProtocolLayer : IDisposable string jobId, int? priority, int? maxParallelTasks, + bool? allowTaskPreemption, Models.OnAllTasksComplete? onAllTasksComplete, Models.PoolInformation poolInfo, Models.JobConstraints constraints, @@ -82,7 +83,9 @@ internal interface IProtocolLayer : IDisposable int? priority, Models.OnAllTasksComplete? onAllTasksComplete, Models.PoolInformation poolInfo, - Models.JobConstraints constraints, + Models.JobConstraints constraints, + int? maxParallelTasks, + bool? allowTaskPreemption, IList metadata, BehaviorManager bhMgr, CancellationToken cancellationToken); diff --git a/sdk/batch/Microsoft.Azure.Batch/src/Microsoft.Azure.Batch.csproj b/sdk/batch/Microsoft.Azure.Batch/src/Microsoft.Azure.Batch.csproj index 94fe3877dc4d..5025080de3dd 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/Microsoft.Azure.Batch.csproj +++ b/sdk/batch/Microsoft.Azure.Batch/src/Microsoft.Azure.Batch.csproj @@ -1,9 +1,8 @@ - + This client library provides access to the Microsoft Azure Batch service. - 15.2.0 + 15.3.0 - 15.1.0 $(DefineConstants);CODESIGN true Microsoft Azure Batch diff --git a/sdk/batch/Microsoft.Azure.Batch/src/ProtocolLayer.cs b/sdk/batch/Microsoft.Azure.Batch/src/ProtocolLayer.cs index 45d05250681d..10e9a4ccfffd 100644 --- a/sdk/batch/Microsoft.Azure.Batch/src/ProtocolLayer.cs +++ b/sdk/batch/Microsoft.Azure.Batch/src/ProtocolLayer.cs @@ -412,11 +412,13 @@ internal ProtocolLayer(Protocol.BatchServiceClient clientToUse) Models.OnAllTasksComplete? onAllTasksComplete, Models.PoolInformation poolInfo, Models.JobConstraints constraints, + int? maxParallelTasks, + bool? allowTaskPreemption, IList metadata, BehaviorManager bhMgr, CancellationToken cancellationToken) { - var parameters = new Models.JobUpdateParameter(poolInfo, priority, constraints, metadata, onAllTasksComplete); + var parameters = new Models.JobUpdateParameter(poolInfo, priority, maxParallelTasks, allowTaskPreemption, constraints, metadata, onAllTasksComplete); var request = new JobUpdateBatchRequest(this._client, parameters, cancellationToken); request.ServiceRequestFunc = (lambdaCancelToken) => request.RestClient.Job.UpdateWithHttpMessagesAsync( @@ -435,6 +437,7 @@ internal ProtocolLayer(Protocol.BatchServiceClient clientToUse) string jobId, int? priority, int? maxParallelTasks, + bool? allowTaskPreemption, Models.OnAllTasksComplete? onAllTasksComplete, Models.PoolInformation poolInfo, Models.JobConstraints constraints, @@ -442,7 +445,7 @@ internal ProtocolLayer(Protocol.BatchServiceClient clientToUse) BehaviorManager bhMgr, CancellationToken cancellationToken) { - var parameters = new Models.JobPatchParameter(priority, maxParallelTasks, onAllTasksComplete, constraints, poolInfo, metadata); + var parameters = new Models.JobPatchParameter(priority, maxParallelTasks, allowTaskPreemption, onAllTasksComplete, constraints, poolInfo, metadata); var request = new JobPatchBatchRequest(this._client, parameters, cancellationToken); request.ServiceRequestFunc = (lambdaCancelToken) => request.RestClient.Job.PatchWithHttpMessagesAsync( diff --git a/sdk/batch/Microsoft.Azure.Batch/tests/IntegrationTests/CloudTaskLinuxIntegrationTests.cs b/sdk/batch/Microsoft.Azure.Batch/tests/IntegrationTests/CloudTaskLinuxIntegrationTests.cs index ce463bbbfecf..7b2292cd9541 100644 --- a/sdk/batch/Microsoft.Azure.Batch/tests/IntegrationTests/CloudTaskLinuxIntegrationTests.cs +++ b/sdk/batch/Microsoft.Azure.Batch/tests/IntegrationTests/CloudTaskLinuxIntegrationTests.cs @@ -16,6 +16,7 @@ namespace BatchClientIntegrationTests using Microsoft.Azure.Batch.Integration.Tests.IntegrationTestUtilities; using Azure.Storage.Blobs; using System.Threading.Tasks; + using Azure.Storage.Blobs.Models; [Collection("SharedLinuxPoolCollection")] public class CloudTaskLinuxIntegrationTests @@ -48,13 +49,16 @@ async Task test() containerClient.CreateIfNotExists(); string sasUri = BlobUtilities.GetWriteableSasUri(containerClient, storageAccount); - CloudJob createJob = batchCli.JobOperations.CreateJob(jobId, new PoolInformation() { PoolId = poolFixture.PoolId }); + CloudJob createJob = batchCli.JobOperations.CreateJob(jobId, new PoolInformation { PoolId = poolFixture.PoolId }); createJob.Commit(); const string blobPrefix = "foo/bar"; const string taskId = "simpletask"; - OutputFileDestination destination = new OutputFileDestination(new OutputFileBlobContainerDestination(sasUri, blobPrefix)); + OutputFileBlobContainerDestination containerDestination = new OutputFileBlobContainerDestination(sasUri, blobPrefix); + containerDestination.UploadHeaders = new List { new HttpHeader("x-ms-blob-content-type", "test-type") }; + + OutputFileDestination destination = new OutputFileDestination(containerDestination); OutputFileUploadOptions uploadOptions = new OutputFileUploadOptions(uploadCondition: OutputFileUploadCondition.TaskCompletion); CloudTask unboundTask = new CloudTask(taskId, "echo test") { @@ -66,17 +70,18 @@ async Task test() batchCli.JobOperations.AddTask(jobId, unboundTask); - var tasks = batchCli.JobOperations.ListTasks(jobId); + IPagedEnumerable tasks = batchCli.JobOperations.ListTasks(jobId); - var monitor = batchCli.Utilities.CreateTaskStateMonitor(); + TaskStateMonitor monitor = batchCli.Utilities.CreateTaskStateMonitor(); monitor.WaitAll(tasks, TaskState.Completed, TimeSpan.FromMinutes(1)); // Ensure that the correct files got uploaded - var blobs = containerClient.GetAllBlobs(); + List blobs = containerClient.GetAllBlobs(); Assert.Equal(4, blobs.Count()); //There are 4 .txt files created, stdout, stderr, fileuploadout, and fileuploaderr - foreach (var blob in blobs) + foreach (BlobItem blob in blobs) { Assert.StartsWith(blobPrefix, blob.Name); + Assert.Equal("test-type", blob.Properties.ContentType); // Ensure test Upload header was applied to blob. } } finally @@ -101,24 +106,21 @@ void test() try { - var job = client.JobOperations.CreateJob(jobId, new PoolInformation() - { - PoolId = poolFixture.PoolId - }); + CloudJob job = client.JobOperations.CreateJob(jobId, new PoolInformation { PoolId = poolFixture.PoolId }); job.Commit(); - var newTask = new CloudTask("a", "cat /etc/centos-release") + CloudTask newTask = new CloudTask("a", "cat /etc/centos-release") { ContainerSettings = new TaskContainerSettings("centos") }; client.JobOperations.AddTask(jobId, newTask); - var tasks = client.JobOperations.ListTasks(jobId); + IPagedEnumerable tasks = client.JobOperations.ListTasks(jobId); - var monitor = client.Utilities.CreateTaskStateMonitor(); + TaskStateMonitor monitor = client.Utilities.CreateTaskStateMonitor(); monitor.WaitAll(tasks, TaskState.Completed, TimeSpan.FromMinutes(7)); - var task = tasks.Single(); + CloudTask task = tasks.Single(); task.Refresh(); Assert.Equal("ContainerPoolNotSupported", task.ExecutionInformation.FailureInformation.Code);