| | 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 FileStaging; |
| | 16 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 17 | | using System; |
| | 18 | | using System.Collections.Generic; |
| | 19 | | using System.Linq; |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// An Azure Batch task. A task is a piece of work that is associated with a job and runs on a compute node. |
| | 23 | | /// </summary> |
| | 24 | | /// <remarks> |
| | 25 | | /// Batch will retry tasks when a recovery operation is triggered on a compute node. Examples of recovery operations |
| | 26 | | /// include (but are not limited to) when an unhealthy compute node is rebooted or a compute node disappeared due to |
| | 27 | | /// host failure. Retries due to recovery operations are independent of and are not counted against the <see cref="T |
| | 28 | | /// />. Even if the <see cref="TaskConstraints.MaxTaskRetryCount" /> is 0, an internal retry due to a recovery opera |
| | 29 | | /// may occur. Because of this, all tasks should be idempotent. This means tasks need to tolerate being interrupted |
| | 30 | | /// restarted without causing any corruption or duplicate data. The best practice for long running tasks is to use s |
| | 31 | | /// form of checkpointing. The maximum lifetime of a task from addition to completion is 180 days. If a task has not |
| | 32 | | /// completed within 180 days of being added it will be terminated by the Batch service and left in whatever state i |
| | 33 | | /// was in at that time. |
| | 34 | | /// </remarks> |
| | 35 | | public partial class CloudTask : ITransportObjectProvider<Models.TaskAddParameter>, IInheritedBehaviors, IPropertyMe |
| | 36 | | { |
| | 37 | | private class PropertyContainer : PropertyCollection |
| | 38 | | { |
| | 39 | | public readonly PropertyAccessor<AffinityInformation> AffinityInformationProperty; |
| | 40 | | public readonly PropertyAccessor<IList<ApplicationPackageReference>> ApplicationPackageReferencesProperty; |
| | 41 | | public readonly PropertyAccessor<AuthenticationTokenSettings> AuthenticationTokenSettingsProperty; |
| | 42 | | public readonly PropertyAccessor<string> CommandLineProperty; |
| | 43 | | public readonly PropertyAccessor<ComputeNodeInformation> ComputeNodeInformationProperty; |
| | 44 | | public readonly PropertyAccessor<TaskConstraints> ConstraintsProperty; |
| | 45 | | public readonly PropertyAccessor<TaskContainerSettings> ContainerSettingsProperty; |
| | 46 | | public readonly PropertyAccessor<DateTime?> CreationTimeProperty; |
| | 47 | | public readonly PropertyAccessor<TaskDependencies> DependsOnProperty; |
| | 48 | | public readonly PropertyAccessor<string> DisplayNameProperty; |
| | 49 | | public readonly PropertyAccessor<IList<EnvironmentSetting>> EnvironmentSettingsProperty; |
| | 50 | | public readonly PropertyAccessor<string> ETagProperty; |
| | 51 | | public readonly PropertyAccessor<TaskExecutionInformation> ExecutionInformationProperty; |
| | 52 | | public readonly PropertyAccessor<ExitConditions> ExitConditionsProperty; |
| | 53 | | public readonly PropertyAccessor<IList<IFileStagingProvider>> FilesToStageProperty; |
| | 54 | | public readonly PropertyAccessor<string> IdProperty; |
| | 55 | | public readonly PropertyAccessor<DateTime?> LastModifiedProperty; |
| | 56 | | public readonly PropertyAccessor<MultiInstanceSettings> MultiInstanceSettingsProperty; |
| | 57 | | public readonly PropertyAccessor<IList<OutputFile>> OutputFilesProperty; |
| | 58 | | public readonly PropertyAccessor<Common.TaskState?> PreviousStateProperty; |
| | 59 | | public readonly PropertyAccessor<DateTime?> PreviousStateTransitionTimeProperty; |
| | 60 | | public readonly PropertyAccessor<IList<ResourceFile>> ResourceFilesProperty; |
| | 61 | | public readonly PropertyAccessor<Common.TaskState?> StateProperty; |
| | 62 | | public readonly PropertyAccessor<DateTime?> StateTransitionTimeProperty; |
| | 63 | | public readonly PropertyAccessor<TaskStatistics> StatisticsProperty; |
| | 64 | | public readonly PropertyAccessor<string> UrlProperty; |
| | 65 | | public readonly PropertyAccessor<UserIdentity> UserIdentityProperty; |
| | 66 | |
|
| 0 | 67 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 68 | | { |
| 0 | 69 | | this.AffinityInformationProperty = this.CreatePropertyAccessor<AffinityInformation>(nameof(AffinityInfor |
| 0 | 70 | | this.ApplicationPackageReferencesProperty = this.CreatePropertyAccessor<IList<ApplicationPackageReferenc |
| 0 | 71 | | this.AuthenticationTokenSettingsProperty = this.CreatePropertyAccessor<AuthenticationTokenSettings>(name |
| 0 | 72 | | this.CommandLineProperty = this.CreatePropertyAccessor<string>(nameof(CommandLine), BindingAccess.Read | |
| 0 | 73 | | this.ComputeNodeInformationProperty = this.CreatePropertyAccessor<ComputeNodeInformation>(nameof(Compute |
| 0 | 74 | | this.ConstraintsProperty = this.CreatePropertyAccessor<TaskConstraints>(nameof(Constraints), BindingAcce |
| 0 | 75 | | this.ContainerSettingsProperty = this.CreatePropertyAccessor<TaskContainerSettings>(nameof(ContainerSett |
| 0 | 76 | | this.CreationTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(CreationTime), BindingAccess.N |
| 0 | 77 | | this.DependsOnProperty = this.CreatePropertyAccessor<TaskDependencies>(nameof(DependsOn), BindingAccess. |
| 0 | 78 | | this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read | |
| 0 | 79 | | this.EnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(Environ |
| 0 | 80 | | this.ETagProperty = this.CreatePropertyAccessor<string>(nameof(ETag), BindingAccess.None); |
| 0 | 81 | | this.ExecutionInformationProperty = this.CreatePropertyAccessor<TaskExecutionInformation>(nameof(Executi |
| 0 | 82 | | this.ExitConditionsProperty = this.CreatePropertyAccessor<ExitConditions>(nameof(ExitConditions), Bindin |
| 0 | 83 | | this.FilesToStageProperty = this.CreatePropertyAccessor<IList<IFileStagingProvider>>(nameof(FilesToStage |
| 0 | 84 | | this.IdProperty = this.CreatePropertyAccessor<string>(nameof(Id), BindingAccess.Read | BindingAccess.Wri |
| 0 | 85 | | this.LastModifiedProperty = this.CreatePropertyAccessor<DateTime?>(nameof(LastModified), BindingAccess.N |
| 0 | 86 | | this.MultiInstanceSettingsProperty = this.CreatePropertyAccessor<MultiInstanceSettings>(nameof(MultiInst |
| 0 | 87 | | this.OutputFilesProperty = this.CreatePropertyAccessor<IList<OutputFile>>(nameof(OutputFiles), BindingAc |
| 0 | 88 | | this.PreviousStateProperty = this.CreatePropertyAccessor<Common.TaskState?>(nameof(PreviousState), Bindi |
| 0 | 89 | | this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(PreviousStateTr |
| 0 | 90 | | this.ResourceFilesProperty = this.CreatePropertyAccessor<IList<ResourceFile>>(nameof(ResourceFiles), Bin |
| 0 | 91 | | this.StateProperty = this.CreatePropertyAccessor<Common.TaskState?>(nameof(State), BindingAccess.None); |
| 0 | 92 | | this.StateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(StateTransitionTime), B |
| 0 | 93 | | this.StatisticsProperty = this.CreatePropertyAccessor<TaskStatistics>(nameof(Statistics), BindingAccess. |
| 0 | 94 | | this.UrlProperty = this.CreatePropertyAccessor<string>(nameof(Url), BindingAccess.None); |
| 0 | 95 | | this.UserIdentityProperty = this.CreatePropertyAccessor<UserIdentity>(nameof(UserIdentity), BindingAcces |
| 0 | 96 | | } |
| | 97 | |
|
| 0 | 98 | | public PropertyContainer(Models.CloudTask protocolObject) : base(BindingState.Bound) |
| | 99 | | { |
| 0 | 100 | | this.AffinityInformationProperty = this.CreatePropertyAccessor( |
| 0 | 101 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.AffinityInfo, o => new AffinityInformatio |
| 0 | 102 | | nameof(AffinityInformation), |
| 0 | 103 | | BindingAccess.Read); |
| 0 | 104 | | this.ApplicationPackageReferencesProperty = this.CreatePropertyAccessor( |
| 0 | 105 | | ApplicationPackageReference.ConvertFromProtocolCollectionAndFreeze(protocolObject.ApplicationPackage |
| 0 | 106 | | nameof(ApplicationPackageReferences), |
| 0 | 107 | | BindingAccess.Read); |
| 0 | 108 | | this.AuthenticationTokenSettingsProperty = this.CreatePropertyAccessor( |
| 0 | 109 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.AuthenticationTokenSettings, o => new Aut |
| 0 | 110 | | nameof(AuthenticationTokenSettings), |
| 0 | 111 | | BindingAccess.Read); |
| 0 | 112 | | this.CommandLineProperty = this.CreatePropertyAccessor( |
| 0 | 113 | | protocolObject.CommandLine, |
| 0 | 114 | | nameof(CommandLine), |
| 0 | 115 | | BindingAccess.Read); |
| 0 | 116 | | this.ComputeNodeInformationProperty = this.CreatePropertyAccessor( |
| 0 | 117 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NodeInfo, o => new ComputeNodeInformation |
| 0 | 118 | | nameof(ComputeNodeInformation), |
| 0 | 119 | | BindingAccess.Read); |
| 0 | 120 | | this.ConstraintsProperty = this.CreatePropertyAccessor( |
| 0 | 121 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new TaskConstraints(o)) |
| 0 | 122 | | nameof(Constraints), |
| 0 | 123 | | BindingAccess.Read | BindingAccess.Write); |
| 0 | 124 | | this.ContainerSettingsProperty = this.CreatePropertyAccessor( |
| 0 | 125 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ContainerSettings, o => new TaskContainer |
| 0 | 126 | | nameof(ContainerSettings), |
| 0 | 127 | | BindingAccess.Read); |
| 0 | 128 | | this.CreationTimeProperty = this.CreatePropertyAccessor( |
| 0 | 129 | | protocolObject.CreationTime, |
| 0 | 130 | | nameof(CreationTime), |
| 0 | 131 | | BindingAccess.Read); |
| 0 | 132 | | this.DependsOnProperty = this.CreatePropertyAccessor( |
| 0 | 133 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.DependsOn, o => new TaskDependencies(o).F |
| 0 | 134 | | nameof(DependsOn), |
| 0 | 135 | | BindingAccess.Read); |
| 0 | 136 | | this.DisplayNameProperty = this.CreatePropertyAccessor( |
| 0 | 137 | | protocolObject.DisplayName, |
| 0 | 138 | | nameof(DisplayName), |
| 0 | 139 | | BindingAccess.Read); |
| 0 | 140 | | this.EnvironmentSettingsProperty = this.CreatePropertyAccessor( |
| 0 | 141 | | EnvironmentSetting.ConvertFromProtocolCollectionAndFreeze(protocolObject.EnvironmentSettings), |
| 0 | 142 | | nameof(EnvironmentSettings), |
| 0 | 143 | | BindingAccess.Read); |
| 0 | 144 | | this.ETagProperty = this.CreatePropertyAccessor( |
| 0 | 145 | | protocolObject.ETag, |
| 0 | 146 | | nameof(ETag), |
| 0 | 147 | | BindingAccess.Read); |
| 0 | 148 | | this.ExecutionInformationProperty = this.CreatePropertyAccessor( |
| 0 | 149 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExecutionInfo, o => new TaskExecutionInfo |
| 0 | 150 | | nameof(ExecutionInformation), |
| 0 | 151 | | BindingAccess.Read); |
| 0 | 152 | | this.ExitConditionsProperty = this.CreatePropertyAccessor( |
| 0 | 153 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExitConditions, o => new ExitConditions(o |
| 0 | 154 | | nameof(ExitConditions), |
| 0 | 155 | | BindingAccess.Read); |
| 0 | 156 | | this.FilesToStageProperty = this.CreatePropertyAccessor<IList<IFileStagingProvider>>( |
| 0 | 157 | | nameof(FilesToStage), |
| 0 | 158 | | BindingAccess.None); |
| 0 | 159 | | this.IdProperty = this.CreatePropertyAccessor( |
| 0 | 160 | | protocolObject.Id, |
| 0 | 161 | | nameof(Id), |
| 0 | 162 | | BindingAccess.Read); |
| 0 | 163 | | this.LastModifiedProperty = this.CreatePropertyAccessor( |
| 0 | 164 | | protocolObject.LastModified, |
| 0 | 165 | | nameof(LastModified), |
| 0 | 166 | | BindingAccess.Read); |
| 0 | 167 | | this.MultiInstanceSettingsProperty = this.CreatePropertyAccessor( |
| 0 | 168 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.MultiInstanceSettings, o => new MultiInst |
| 0 | 169 | | nameof(MultiInstanceSettings), |
| 0 | 170 | | BindingAccess.Read); |
| 0 | 171 | | this.OutputFilesProperty = this.CreatePropertyAccessor( |
| 0 | 172 | | OutputFile.ConvertFromProtocolCollectionAndFreeze(protocolObject.OutputFiles), |
| 0 | 173 | | nameof(OutputFiles), |
| 0 | 174 | | BindingAccess.Read); |
| 0 | 175 | | this.PreviousStateProperty = this.CreatePropertyAccessor( |
| 0 | 176 | | UtilitiesInternal.MapNullableEnum<Models.TaskState, Common.TaskState>(protocolObject.PreviousState), |
| 0 | 177 | | nameof(PreviousState), |
| 0 | 178 | | BindingAccess.Read); |
| 0 | 179 | | this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor( |
| 0 | 180 | | protocolObject.PreviousStateTransitionTime, |
| 0 | 181 | | nameof(PreviousStateTransitionTime), |
| 0 | 182 | | BindingAccess.Read); |
| 0 | 183 | | this.ResourceFilesProperty = this.CreatePropertyAccessor( |
| 0 | 184 | | ResourceFile.ConvertFromProtocolCollectionAndFreeze(protocolObject.ResourceFiles), |
| 0 | 185 | | nameof(ResourceFiles), |
| 0 | 186 | | BindingAccess.Read); |
| 0 | 187 | | this.StateProperty = this.CreatePropertyAccessor( |
| 0 | 188 | | UtilitiesInternal.MapNullableEnum<Models.TaskState, Common.TaskState>(protocolObject.State), |
| 0 | 189 | | nameof(State), |
| 0 | 190 | | BindingAccess.Read); |
| 0 | 191 | | this.StateTransitionTimeProperty = this.CreatePropertyAccessor( |
| 0 | 192 | | protocolObject.StateTransitionTime, |
| 0 | 193 | | nameof(StateTransitionTime), |
| 0 | 194 | | BindingAccess.Read); |
| 0 | 195 | | this.StatisticsProperty = this.CreatePropertyAccessor( |
| 0 | 196 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Stats, o => new TaskStatistics(o).Freeze( |
| 0 | 197 | | nameof(Statistics), |
| 0 | 198 | | BindingAccess.Read); |
| 0 | 199 | | this.UrlProperty = this.CreatePropertyAccessor( |
| 0 | 200 | | protocolObject.Url, |
| 0 | 201 | | nameof(Url), |
| 0 | 202 | | BindingAccess.Read); |
| 0 | 203 | | this.UserIdentityProperty = this.CreatePropertyAccessor( |
| 0 | 204 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.UserIdentity, o => new UserIdentity(o).Fr |
| 0 | 205 | | nameof(UserIdentity), |
| 0 | 206 | | BindingAccess.Read); |
| 0 | 207 | | } |
| | 208 | | } |
| | 209 | |
|
| | 210 | | private PropertyContainer propertyContainer; |
| | 211 | |
|
| | 212 | | private readonly BatchClient parentBatchClient; |
| | 213 | | private readonly string parentJobId; |
| | 214 | |
|
| | 215 | | internal string ParentJobId |
| | 216 | | { |
| | 217 | | get |
| | 218 | | { |
| 0 | 219 | | return this.parentJobId; |
| | 220 | | } |
| | 221 | | } |
| | 222 | |
|
| | 223 | | #region Constructors |
| | 224 | |
|
| 0 | 225 | | internal CloudTask( |
| 0 | 226 | | BatchClient parentBatchClient, |
| 0 | 227 | | string parentJobId, |
| 0 | 228 | | Models.CloudTask protocolObject, |
| 0 | 229 | | IEnumerable<BatchClientBehavior> baseBehaviors) |
| | 230 | | { |
| 0 | 231 | | this.parentJobId = parentJobId; |
| 0 | 232 | | this.parentBatchClient = parentBatchClient; |
| 0 | 233 | | InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors); |
| 0 | 234 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 0 | 235 | | } |
| | 236 | |
|
| | 237 | | #endregion Constructors |
| | 238 | |
|
| | 239 | | #region IInheritedBehaviors |
| | 240 | |
|
| | 241 | | /// <summary> |
| | 242 | | /// Gets or sets a list of behaviors that modify or customize requests to the Batch service |
| | 243 | | /// made via this <see cref="CloudTask"/>. |
| | 244 | | /// </summary> |
| | 245 | | /// <remarks> |
| | 246 | | /// <para>These behaviors are inherited by child objects.</para> |
| | 247 | | /// <para>Modifications are applied in the order of the collection. The last write wins.</para> |
| | 248 | | /// </remarks> |
| 0 | 249 | | public IList<BatchClientBehavior> CustomBehaviors { get; set; } |
| | 250 | |
|
| | 251 | | #endregion IInheritedBehaviors |
| | 252 | |
|
| | 253 | | #region CloudTask |
| | 254 | |
|
| | 255 | | /// <summary> |
| | 256 | | /// Gets or sets a locality hint that can be used by the Batch service to select a node on which to start the ta |
| | 257 | | /// </summary> |
| | 258 | | public AffinityInformation AffinityInformation |
| | 259 | | { |
| 0 | 260 | | get { return this.propertyContainer.AffinityInformationProperty.Value; } |
| 0 | 261 | | set { this.propertyContainer.AffinityInformationProperty.Value = value; } |
| | 262 | | } |
| | 263 | |
|
| | 264 | | /// <summary> |
| | 265 | | /// Gets or sets a list of application packages that the Batch service will deploy to the compute node before ru |
| | 266 | | /// the command line. |
| | 267 | | /// </summary> |
| | 268 | | public IList<ApplicationPackageReference> ApplicationPackageReferences |
| | 269 | | { |
| 0 | 270 | | get { return this.propertyContainer.ApplicationPackageReferencesProperty.Value; } |
| | 271 | | set |
| | 272 | | { |
| 0 | 273 | | this.propertyContainer.ApplicationPackageReferencesProperty.Value = ConcurrentChangeTrackedModifiableLis |
| 0 | 274 | | } |
| | 275 | | } |
| | 276 | |
|
| | 277 | | /// <summary> |
| | 278 | | /// Gets or sets the settings for an authentication token that the task can use to perform Batch service operati |
| | 279 | | /// </summary> |
| | 280 | | /// <remarks> |
| | 281 | | /// If this property is set, the Batch service provides the task with an authentication token which can be used |
| | 282 | | /// authenticate Batch service operations without requiring an account access key. The token is provided via the |
| | 283 | | /// AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the tok |
| | 284 | | /// depend on the settings. For example, a task can request job permissions in order to add other tasks to the j |
| | 285 | | /// or check the status of the job or of other tasks. |
| | 286 | | /// </remarks> |
| | 287 | | public AuthenticationTokenSettings AuthenticationTokenSettings |
| | 288 | | { |
| 0 | 289 | | get { return this.propertyContainer.AuthenticationTokenSettingsProperty.Value; } |
| 0 | 290 | | set { this.propertyContainer.AuthenticationTokenSettingsProperty.Value = value; } |
| | 291 | | } |
| | 292 | |
|
| | 293 | | /// <summary> |
| | 294 | | /// Gets or sets the command line of the task. |
| | 295 | | /// </summary> |
| | 296 | | /// <remarks> |
| | 297 | | /// The command line does not run under a shell, and therefore cannot take advantage of shell features such as e |
| | 298 | | /// variable expansion. If you want to take advantage of such features, you should invoke the shell in the comma |
| | 299 | | /// line, for example using \"cmd /c MyCommand\" in Windows or \"/bin/sh -c MyCommand\" in Linux. If the command |
| | 300 | | /// line refers to file paths, it should use a relative path (relative to the task working directory), or use th |
| | 301 | | /// Batch provided environment variables (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-enviro |
| | 302 | | /// </remarks> |
| | 303 | | public string CommandLine |
| | 304 | | { |
| 0 | 305 | | get { return this.propertyContainer.CommandLineProperty.Value; } |
| 0 | 306 | | set { this.propertyContainer.CommandLineProperty.Value = value; } |
| | 307 | | } |
| | 308 | |
|
| | 309 | | /// <summary> |
| | 310 | | /// Gets information about the compute node on which the task ran. |
| | 311 | | /// </summary> |
| | 312 | | public ComputeNodeInformation ComputeNodeInformation |
| | 313 | | { |
| 0 | 314 | | get { return this.propertyContainer.ComputeNodeInformationProperty.Value; } |
| | 315 | | } |
| | 316 | |
|
| | 317 | | /// <summary> |
| | 318 | | /// Gets or sets the execution constraints that apply to this task. |
| | 319 | | /// </summary> |
| | 320 | | public TaskConstraints Constraints |
| | 321 | | { |
| 0 | 322 | | get { return this.propertyContainer.ConstraintsProperty.Value; } |
| 0 | 323 | | set { this.propertyContainer.ConstraintsProperty.Value = value; } |
| | 324 | | } |
| | 325 | |
|
| | 326 | | /// <summary> |
| | 327 | | /// Gets or sets the settings for the container under which the task runs. |
| | 328 | | /// </summary> |
| | 329 | | /// <remarks> |
| | 330 | | /// If the pool that will run this task has <see cref="VirtualMachineConfiguration.ContainerConfiguration"/> set |
| | 331 | | /// this must be set as well. If the pool that will run this task doesn't have <see cref="VirtualMachineConfigur |
| | 332 | | /// set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_ |
| | 333 | | /// (the root of Azure Batch directories on the node) are mapped into the container, all task environment variab |
| | 334 | | /// are mapped into the container, and the task command line is executed in the container. Files produced in the |
| | 335 | | /// container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file |
| | 336 | | /// APIs will not be able to access them. |
| | 337 | | /// </remarks> |
| | 338 | | public TaskContainerSettings ContainerSettings |
| | 339 | | { |
| 0 | 340 | | get { return this.propertyContainer.ContainerSettingsProperty.Value; } |
| 0 | 341 | | set { this.propertyContainer.ContainerSettingsProperty.Value = value; } |
| | 342 | | } |
| | 343 | |
|
| | 344 | | /// <summary> |
| | 345 | | /// Gets the creation time of the task. |
| | 346 | | /// </summary> |
| | 347 | | public DateTime? CreationTime |
| | 348 | | { |
| 0 | 349 | | get { return this.propertyContainer.CreationTimeProperty.Value; } |
| | 350 | | } |
| | 351 | |
|
| | 352 | | /// <summary> |
| | 353 | | /// Gets or sets any other tasks that this <see cref="CloudTask"/> depends on. The task will not be scheduled un |
| | 354 | | /// all depended-on tasks have completed successfully. |
| | 355 | | /// </summary> |
| | 356 | | /// <remarks> |
| | 357 | | /// The job must set <see cref="CloudJob.UsesTaskDependencies"/> to true in order to use task dependencies. If U |
| | 358 | | /// is false (the default), adding a task with dependencies will fail with an error. |
| | 359 | | /// </remarks> |
| | 360 | | public TaskDependencies DependsOn |
| | 361 | | { |
| 0 | 362 | | get { return this.propertyContainer.DependsOnProperty.Value; } |
| 0 | 363 | | set { this.propertyContainer.DependsOnProperty.Value = value; } |
| | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> |
| | 367 | | /// Gets or sets the display name of the task. |
| | 368 | | /// </summary> |
| | 369 | | public string DisplayName |
| | 370 | | { |
| 0 | 371 | | get { return this.propertyContainer.DisplayNameProperty.Value; } |
| 0 | 372 | | set { this.propertyContainer.DisplayNameProperty.Value = value; } |
| | 373 | | } |
| | 374 | |
|
| | 375 | | /// <summary> |
| | 376 | | /// Gets or sets a list of environment variable settings for the task. |
| | 377 | | /// </summary> |
| | 378 | | public IList<EnvironmentSetting> EnvironmentSettings |
| | 379 | | { |
| 0 | 380 | | get { return this.propertyContainer.EnvironmentSettingsProperty.Value; } |
| | 381 | | set |
| | 382 | | { |
| 0 | 383 | | this.propertyContainer.EnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<Environ |
| 0 | 384 | | } |
| | 385 | | } |
| | 386 | |
|
| | 387 | | /// <summary> |
| | 388 | | /// Gets the ETag for the task. |
| | 389 | | /// </summary> |
| | 390 | | public string ETag |
| | 391 | | { |
| 0 | 392 | | get { return this.propertyContainer.ETagProperty.Value; } |
| | 393 | | } |
| | 394 | |
|
| | 395 | | /// <summary> |
| | 396 | | /// Gets the execution information for the task. |
| | 397 | | /// </summary> |
| | 398 | | public TaskExecutionInformation ExecutionInformation |
| | 399 | | { |
| 0 | 400 | | get { return this.propertyContainer.ExecutionInformationProperty.Value; } |
| | 401 | | } |
| | 402 | |
|
| | 403 | | /// <summary> |
| | 404 | | /// Gets or sets how the Batch service should respond when the task completes. |
| | 405 | | /// </summary> |
| | 406 | | public ExitConditions ExitConditions |
| | 407 | | { |
| 0 | 408 | | get { return this.propertyContainer.ExitConditionsProperty.Value; } |
| 0 | 409 | | set { this.propertyContainer.ExitConditionsProperty.Value = value; } |
| | 410 | | } |
| | 411 | |
|
| | 412 | | /// <summary> |
| | 413 | | /// Gets or sets a list of files to be staged for the task. |
| | 414 | | /// </summary> |
| | 415 | | public IList<IFileStagingProvider> FilesToStage |
| | 416 | | { |
| 0 | 417 | | get { return this.propertyContainer.FilesToStageProperty.Value; } |
| | 418 | | set |
| | 419 | | { |
| 0 | 420 | | this.propertyContainer.FilesToStageProperty.Value = ConcurrentChangeTrackedList<IFileStagingProvider>.Tr |
| 0 | 421 | | } |
| | 422 | | } |
| | 423 | |
|
| | 424 | | /// <summary> |
| | 425 | | /// Gets or sets the id of the task. |
| | 426 | | /// </summary> |
| | 427 | | public string Id |
| | 428 | | { |
| 0 | 429 | | get { return this.propertyContainer.IdProperty.Value; } |
| 0 | 430 | | set { this.propertyContainer.IdProperty.Value = value; } |
| | 431 | | } |
| | 432 | |
|
| | 433 | | /// <summary> |
| | 434 | | /// Gets the last modified time of the task. |
| | 435 | | /// </summary> |
| | 436 | | public DateTime? LastModified |
| | 437 | | { |
| 0 | 438 | | get { return this.propertyContainer.LastModifiedProperty.Value; } |
| | 439 | | } |
| | 440 | |
|
| | 441 | | /// <summary> |
| | 442 | | /// Gets or sets information about how to run the multi-instance task. |
| | 443 | | /// </summary> |
| | 444 | | public MultiInstanceSettings MultiInstanceSettings |
| | 445 | | { |
| 0 | 446 | | get { return this.propertyContainer.MultiInstanceSettingsProperty.Value; } |
| 0 | 447 | | set { this.propertyContainer.MultiInstanceSettingsProperty.Value = value; } |
| | 448 | | } |
| | 449 | |
|
| | 450 | | /// <summary> |
| | 451 | | /// Gets or sets a list of files that the Batch service will upload from the compute node after running the comm |
| | 452 | | /// line. |
| | 453 | | /// </summary> |
| | 454 | | public IList<OutputFile> OutputFiles |
| | 455 | | { |
| 0 | 456 | | get { return this.propertyContainer.OutputFilesProperty.Value; } |
| | 457 | | set |
| | 458 | | { |
| 0 | 459 | | this.propertyContainer.OutputFilesProperty.Value = ConcurrentChangeTrackedModifiableList<OutputFile>.Tra |
| 0 | 460 | | } |
| | 461 | | } |
| | 462 | |
|
| | 463 | | /// <summary> |
| | 464 | | /// Gets the previous state of the task. |
| | 465 | | /// </summary> |
| | 466 | | /// <remarks> |
| | 467 | | /// If the task is in its initial <see cref="Common.TaskState.Active"/> state, the PreviousState property is not |
| | 468 | | /// defined. |
| | 469 | | /// </remarks> |
| | 470 | | public Common.TaskState? PreviousState |
| | 471 | | { |
| 0 | 472 | | get { return this.propertyContainer.PreviousStateProperty.Value; } |
| | 473 | | } |
| | 474 | |
|
| | 475 | | /// <summary> |
| | 476 | | /// Gets the time at which the task entered its previous state. |
| | 477 | | /// </summary> |
| | 478 | | /// <remarks> |
| | 479 | | /// If the task is in its initial <see cref="Common.TaskState.Active"/> state, the PreviousStateTransitionTime p |
| | 480 | | /// is not defined. |
| | 481 | | /// </remarks> |
| | 482 | | public DateTime? PreviousStateTransitionTime |
| | 483 | | { |
| 0 | 484 | | get { return this.propertyContainer.PreviousStateTransitionTimeProperty.Value; } |
| | 485 | | } |
| | 486 | |
|
| | 487 | | /// <summary> |
| | 488 | | /// Gets or sets a list of files that the Batch service will download to the compute node before running the com |
| | 489 | | /// line. |
| | 490 | | /// </summary> |
| | 491 | | /// <remarks> |
| | 492 | | /// There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail |
| | 493 | | /// and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files |
| | 494 | | /// be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. |
| | 495 | | /// </remarks> |
| | 496 | | public IList<ResourceFile> ResourceFiles |
| | 497 | | { |
| 0 | 498 | | get { return this.propertyContainer.ResourceFilesProperty.Value; } |
| | 499 | | set |
| | 500 | | { |
| 0 | 501 | | this.propertyContainer.ResourceFilesProperty.Value = ConcurrentChangeTrackedModifiableList<ResourceFile> |
| 0 | 502 | | } |
| | 503 | | } |
| | 504 | |
|
| | 505 | | /// <summary> |
| | 506 | | /// Gets the current state of the task. |
| | 507 | | /// </summary> |
| | 508 | | public Common.TaskState? State |
| | 509 | | { |
| 0 | 510 | | get { return this.propertyContainer.StateProperty.Value; } |
| | 511 | | } |
| | 512 | |
|
| | 513 | | /// <summary> |
| | 514 | | /// Gets the time at which the task entered its current state. |
| | 515 | | /// </summary> |
| | 516 | | public DateTime? StateTransitionTime |
| | 517 | | { |
| 0 | 518 | | get { return this.propertyContainer.StateTransitionTimeProperty.Value; } |
| | 519 | | } |
| | 520 | |
|
| | 521 | | /// <summary> |
| | 522 | | /// Gets resource usage statistics for the task. |
| | 523 | | /// </summary> |
| | 524 | | /// <remarks> |
| | 525 | | /// This property is populated only if the <see cref="CloudTask"/> was retrieved with an <see cref="ODATADetailL |
| | 526 | | /// including the 'stats' attribute; otherwise it is null. |
| | 527 | | /// </remarks> |
| | 528 | | public TaskStatistics Statistics |
| | 529 | | { |
| 0 | 530 | | get { return this.propertyContainer.StatisticsProperty.Value; } |
| | 531 | | } |
| | 532 | |
|
| | 533 | | /// <summary> |
| | 534 | | /// Gets the URL of the task. |
| | 535 | | /// </summary> |
| | 536 | | public string Url |
| | 537 | | { |
| 0 | 538 | | get { return this.propertyContainer.UrlProperty.Value; } |
| | 539 | | } |
| | 540 | |
|
| | 541 | | /// <summary> |
| | 542 | | /// Gets or sets the user identity under which the task runs. |
| | 543 | | /// </summary> |
| | 544 | | /// <remarks> |
| | 545 | | /// If omitted, the task runs as a non-administrative user unique to the task. |
| | 546 | | /// </remarks> |
| | 547 | | public UserIdentity UserIdentity |
| | 548 | | { |
| 0 | 549 | | get { return this.propertyContainer.UserIdentityProperty.Value; } |
| 0 | 550 | | set { this.propertyContainer.UserIdentityProperty.Value = value; } |
| | 551 | | } |
| | 552 | |
|
| | 553 | | #endregion // CloudTask |
| | 554 | |
|
| | 555 | | #region IPropertyMetadata |
| | 556 | |
|
| | 557 | | bool IModifiable.HasBeenModified |
| | 558 | | { |
| 0 | 559 | | get { return this.propertyContainer.HasBeenModified; } |
| | 560 | | } |
| | 561 | |
|
| | 562 | | bool IReadOnly.IsReadOnly |
| | 563 | | { |
| 0 | 564 | | get { return this.propertyContainer.IsReadOnly; } |
| 0 | 565 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 566 | | } |
| | 567 | |
|
| | 568 | | #endregion //IPropertyMetadata |
| | 569 | |
|
| | 570 | | #region Internal/private methods |
| | 571 | | /// <summary> |
| | 572 | | /// Return a protocol object of the requested type. |
| | 573 | | /// </summary> |
| | 574 | | /// <returns>The protocol object of the requested type.</returns> |
| | 575 | | Models.TaskAddParameter ITransportObjectProvider<Models.TaskAddParameter>.GetTransportObject() |
| | 576 | | { |
| 0 | 577 | | Models.TaskAddParameter result = new Models.TaskAddParameter() |
| 0 | 578 | | { |
| 0 | 579 | | AffinityInfo = UtilitiesInternal.CreateObjectWithNullCheck(this.AffinityInformation, (o) => o.GetTranspo |
| 0 | 580 | | ApplicationPackageReferences = UtilitiesInternal.ConvertToProtocolCollection(this.ApplicationPackageRefe |
| 0 | 581 | | AuthenticationTokenSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.AuthenticationTokenSettin |
| 0 | 582 | | CommandLine = this.CommandLine, |
| 0 | 583 | | Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject( |
| 0 | 584 | | ContainerSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.ContainerSettings, (o) => o.GetTran |
| 0 | 585 | | DependsOn = UtilitiesInternal.CreateObjectWithNullCheck(this.DependsOn, (o) => o.GetTransportObject()), |
| 0 | 586 | | DisplayName = this.DisplayName, |
| 0 | 587 | | EnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.EnvironmentSettings), |
| 0 | 588 | | ExitConditions = UtilitiesInternal.CreateObjectWithNullCheck(this.ExitConditions, (o) => o.GetTransportO |
| 0 | 589 | | Id = this.Id, |
| 0 | 590 | | MultiInstanceSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.MultiInstanceSettings, (o) => o |
| 0 | 591 | | OutputFiles = UtilitiesInternal.ConvertToProtocolCollection(this.OutputFiles), |
| 0 | 592 | | ResourceFiles = UtilitiesInternal.ConvertToProtocolCollection(this.ResourceFiles), |
| 0 | 593 | | UserIdentity = UtilitiesInternal.CreateObjectWithNullCheck(this.UserIdentity, (o) => o.GetTransportObjec |
| 0 | 594 | | }; |
| | 595 | |
|
| 0 | 596 | | return result; |
| | 597 | | } |
| | 598 | |
|
| | 599 | |
|
| | 600 | | #endregion // Internal/private methods |
| | 601 | | } |
| | 602 | | } |