| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | | // |
| | 4 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 5 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 6 | | // regenerated. |
| | 7 | |
|
| | 8 | | // |
| | 9 | | // This file was autogenerated by a tool. |
| | 10 | | // Do not modify it. |
| | 11 | | // |
| | 12 | |
|
| | 13 | | namespace Microsoft.Azure.Batch |
| | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Defines the constraints on a particular Azure Batch task. |
| | 22 | | /// </summary> |
| | 23 | | public partial class TaskConstraints : ITransportObjectProvider<Models.TaskConstraints>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | private class PropertyContainer : PropertyCollection |
| | 26 | | { |
| | 27 | | public readonly PropertyAccessor<int?> MaxTaskRetryCountProperty; |
| | 28 | | public readonly PropertyAccessor<TimeSpan?> MaxWallClockTimeProperty; |
| | 29 | | public readonly PropertyAccessor<TimeSpan?> RetentionTimeProperty; |
| | 30 | |
|
| 350 | 31 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 32 | | { |
| 350 | 33 | | this.MaxTaskRetryCountProperty = this.CreatePropertyAccessor<int?>(nameof(MaxTaskRetryCount), BindingAcc |
| 350 | 34 | | this.MaxWallClockTimeProperty = this.CreatePropertyAccessor<TimeSpan?>(nameof(MaxWallClockTime), Binding |
| 350 | 35 | | this.RetentionTimeProperty = this.CreatePropertyAccessor<TimeSpan?>(nameof(RetentionTime), BindingAccess |
| 350 | 36 | | } |
| | 37 | |
|
| 1242 | 38 | | public PropertyContainer(Models.TaskConstraints protocolObject) : base(BindingState.Bound) |
| | 39 | | { |
| 1242 | 40 | | this.MaxTaskRetryCountProperty = this.CreatePropertyAccessor( |
| 1242 | 41 | | protocolObject.MaxTaskRetryCount, |
| 1242 | 42 | | nameof(MaxTaskRetryCount), |
| 1242 | 43 | | BindingAccess.Read | BindingAccess.Write); |
| 1242 | 44 | | this.MaxWallClockTimeProperty = this.CreatePropertyAccessor( |
| 1242 | 45 | | protocolObject.MaxWallClockTime, |
| 1242 | 46 | | nameof(MaxWallClockTime), |
| 1242 | 47 | | BindingAccess.Read | BindingAccess.Write); |
| 1242 | 48 | | this.RetentionTimeProperty = this.CreatePropertyAccessor( |
| 1242 | 49 | | protocolObject.RetentionTime, |
| 1242 | 50 | | nameof(RetentionTime), |
| 1242 | 51 | | BindingAccess.Read | BindingAccess.Write); |
| 1242 | 52 | | } |
| | 53 | | } |
| | 54 | |
|
| | 55 | | private readonly PropertyContainer propertyContainer; |
| | 56 | |
|
| | 57 | | #region Constructors |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Initializes a new instance of the <see cref="TaskConstraints"/> class. |
| | 61 | | /// </summary> |
| | 62 | | /// <param name='maxWallClockTime'>The maximum elapsed time that the task may run, measured from the time the ta |
| | 63 | | /// <param name='retentionTime'>The minimum time to retain the working directory for the task on the compute nod |
| | 64 | | /// it completes execution. After this time, the Batch service may delete the working directory and all its cont |
| | 65 | | /// <param name='maxTaskRetryCount'>The maximum number of retries for the task.</param> |
| 350 | 66 | | public TaskConstraints( |
| 350 | 67 | | TimeSpan? maxWallClockTime = default(TimeSpan?), |
| 350 | 68 | | TimeSpan? retentionTime = default(TimeSpan?), |
| 350 | 69 | | int? maxTaskRetryCount = default(int?)) |
| | 70 | | { |
| 350 | 71 | | this.propertyContainer = new PropertyContainer(); |
| 350 | 72 | | this.MaxWallClockTime = maxWallClockTime; |
| 350 | 73 | | this.RetentionTime = retentionTime; |
| 350 | 74 | | this.MaxTaskRetryCount = maxTaskRetryCount; |
| 350 | 75 | | } |
| | 76 | |
|
| 1242 | 77 | | internal TaskConstraints(Models.TaskConstraints protocolObject) |
| | 78 | | { |
| 1242 | 79 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 1242 | 80 | | } |
| | 81 | |
|
| | 82 | | #endregion Constructors |
| | 83 | |
|
| | 84 | | #region TaskConstraints |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// Gets or sets the maximum number of retries for the task. |
| | 88 | | /// </summary> |
| | 89 | | /// <remarks> |
| | 90 | | /// Note that this value specifically controls the number of retries for the task executable due to a nonzero ex |
| | 91 | | /// code. The Batch service will try the task once, and may then retry up to this limit. For example, if the max |
| | 92 | | /// retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry c |
| | 93 | | /// is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, t |
| | 94 | | /// Batch service retries the task without limit. Resource files and application packages are only downloaded ag |
| | 95 | | /// if the task is retried on a new compute node. |
| | 96 | | /// </remarks> |
| | 97 | | public int? MaxTaskRetryCount |
| | 98 | | { |
| 1939 | 99 | | get { return this.propertyContainer.MaxTaskRetryCountProperty.Value; } |
| 1035 | 100 | | set { this.propertyContainer.MaxTaskRetryCountProperty.Value = value; } |
| | 101 | | } |
| | 102 | |
|
| | 103 | | /// <summary> |
| | 104 | | /// Gets or sets the maximum elapsed time that the task may run, measured from the time the task starts. |
| | 105 | | /// </summary> |
| | 106 | | public TimeSpan? MaxWallClockTime |
| | 107 | | { |
| 1939 | 108 | | get { return this.propertyContainer.MaxWallClockTimeProperty.Value; } |
| 1067 | 109 | | set { this.propertyContainer.MaxWallClockTimeProperty.Value = value; } |
| | 110 | | } |
| | 111 | |
|
| | 112 | | /// <summary> |
| | 113 | | /// Gets or sets the minimum time to retain the working directory for the task on the compute node where it ran, |
| | 114 | | /// from the time it completes execution. After this time, the Batch service may delete the working directory an |
| | 115 | | /// all its contents. |
| | 116 | | /// </summary> |
| | 117 | | /// <remarks> |
| | 118 | | /// The default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is remove |
| | 119 | | /// or the job is deleted. |
| | 120 | | /// </remarks> |
| | 121 | | public TimeSpan? RetentionTime |
| | 122 | | { |
| 1939 | 123 | | get { return this.propertyContainer.RetentionTimeProperty.Value; } |
| 1039 | 124 | | set { this.propertyContainer.RetentionTimeProperty.Value = value; } |
| | 125 | | } |
| | 126 | |
|
| | 127 | | #endregion // TaskConstraints |
| | 128 | |
|
| | 129 | | #region IPropertyMetadata |
| | 130 | |
|
| | 131 | | bool IModifiable.HasBeenModified |
| | 132 | | { |
| 0 | 133 | | get { return this.propertyContainer.HasBeenModified; } |
| | 134 | | } |
| | 135 | |
|
| | 136 | | bool IReadOnly.IsReadOnly |
| | 137 | | { |
| 0 | 138 | | get { return this.propertyContainer.IsReadOnly; } |
| 1034 | 139 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 140 | | } |
| | 141 | |
|
| | 142 | | #endregion //IPropertyMetadata |
| | 143 | |
|
| | 144 | | #region Internal/private methods |
| | 145 | | /// <summary> |
| | 146 | | /// Return a protocol object of the requested type. |
| | 147 | | /// </summary> |
| | 148 | | /// <returns>The protocol object of the requested type.</returns> |
| | 149 | | Models.TaskConstraints ITransportObjectProvider<Models.TaskConstraints>.GetTransportObject() |
| | 150 | | { |
| 348 | 151 | | Models.TaskConstraints result = new Models.TaskConstraints() |
| 348 | 152 | | { |
| 348 | 153 | | MaxTaskRetryCount = this.MaxTaskRetryCount, |
| 348 | 154 | | MaxWallClockTime = this.MaxWallClockTime, |
| 348 | 155 | | RetentionTime = this.RetentionTime, |
| 348 | 156 | | }; |
| | 157 | |
|
| 348 | 158 | | return result; |
| | 159 | | } |
| | 160 | |
|
| | 161 | |
|
| | 162 | | #endregion // Internal/private methods |
| | 163 | | } |
| | 164 | | } |