< Summary

Class:Microsoft.Azure.Batch.CloudJob
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CloudJob.cs
C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CloudJob.cs
Covered lines:219
Uncovered lines:256
Coverable lines:475
Total lines:1125
Line coverage:46.1% (219 of 475)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CommitAsync()-100%50%
.ctor()-100%100%
.ctor(...)-100%100%
Commit(...)-100%100%
CommitChangesAsync()-100%100%
CommitChanges(...)-100%100%
AddTaskAsync()-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
AddTask(...)-100%100%
get_CustomBehaviors()-100%100%
get_CommonEnvironmentSettings()-100%100%
set_CommonEnvironmentSettings(...)-100%100%
get_Constraints()-100%100%
set_Constraints(...)-100%100%
get_CreationTime()-100%100%
get_DisplayName()-100%100%
set_DisplayName(...)-100%100%
AddTaskAsync()-16.67%100%
get_ETag()-100%100%
get_ExecutionInformation()-100%100%
get_Id()-100%100%
set_Id(...)-100%100%
get_JobManagerTask()-100%100%
set_JobManagerTask(...)-100%100%
get_JobPreparationTask()-100%100%
set_JobPreparationTask(...)-100%100%
AddTask(...)-50%100%
get_JobReleaseTask()-100%100%
set_JobReleaseTask(...)-100%100%
get_LastModified()-100%100%
ListTasks(...)-50%100%
get_Metadata()-100%100%
set_Metadata(...)-100%100%
get_NetworkConfiguration()-100%100%
set_NetworkConfiguration(...)-100%100%
get_OnAllTasksComplete()-100%100%
set_OnAllTasksComplete(...)-100%100%
GetTaskAsync()-0%100%
get_OnTaskFailure()-100%100%
set_OnTaskFailure(...)-100%100%
get_PoolInformation()-100%100%
set_PoolInformation(...)-100%100%
GetTask(...)-0%100%
get_PreviousState()-100%100%
EnableAsync(...)-20%100%
get_PreviousStateTransitionTime()-100%100%
get_Priority()-100%100%
set_Priority(...)-100%100%
Enable(...)-0%100%
get_State()-100%100%
get_StateTransitionTime()-100%100%
DisableAsync(...)-0%100%
get_Statistics()-100%100%
get_Url()-100%100%
Disable(...)-0%100%
get_UsesTaskDependencies()-100%100%
set_UsesTaskDependencies(...)-100%100%
TerminateAsync(...)-16.67%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-0%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-100%100%
Terminate(...)-66.67%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobAddParameter>.GetTransportObject()-94.74%100%
DeleteAsync(...)-20%100%
Delete(...)-0%100%
RefreshAsync()-100%100%
Refresh(...)-0%100%
GetTaskCountsAsync()-0%100%
GetTaskCounts(...)-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
get_CustomBehaviors()-0%100%
get_CommonEnvironmentSettings()-0%100%
set_CommonEnvironmentSettings(...)-0%100%
get_Constraints()-0%100%
set_Constraints(...)-0%100%
get_CreationTime()-0%100%
get_DisplayName()-0%100%
set_DisplayName(...)-0%100%
get_ETag()-0%100%
get_ExecutionInformation()-0%100%
get_Id()-0%100%
set_Id(...)-0%100%
get_JobManagerTask()-0%100%
set_JobManagerTask(...)-0%100%
get_JobPreparationTask()-0%100%
set_JobPreparationTask(...)-0%100%
get_JobReleaseTask()-0%100%
set_JobReleaseTask(...)-0%100%
get_LastModified()-0%100%
get_Metadata()-0%100%
set_Metadata(...)-0%100%
get_NetworkConfiguration()-0%100%
set_NetworkConfiguration(...)-0%100%
get_OnAllTasksComplete()-0%100%
set_OnAllTasksComplete(...)-0%100%
get_OnTaskFailure()-0%100%
set_OnTaskFailure(...)-0%100%
get_PoolInformation()-0%100%
set_PoolInformation(...)-0%100%
get_PreviousState()-0%100%
get_PreviousStateTransitionTime()-0%100%
get_Priority()-0%100%
set_Priority(...)-0%100%
get_State()-0%100%
get_StateTransitionTime()-0%100%
get_Statistics()-0%100%
get_Url()-0%100%
get_UsesTaskDependencies()-0%100%
set_UsesTaskDependencies(...)-0%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-0%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-0%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobAddParameter>.GetTransportObject()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CloudJob.cs

#LineLine coverage
 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
 4namespace Microsoft.Azure.Batch
 5{
 6    using System;
 7    using System.Collections.Concurrent;
 8    using System.Collections.Generic;
 9    using System.Threading;
 10    using System.Threading.Tasks;
 11    using Microsoft.Rest.Azure;
 12    using Utils;
 13    using Models = Microsoft.Azure.Batch.Protocol.Models;
 14
 15    /// <summary>
 16    /// An Azure Batch job.
 17    /// </summary>
 18    public partial class CloudJob : IRefreshable
 19    {
 20
 21        #region // CloudJob
 22
 23
 24        /// <summary>
 25        /// Commits this <see cref="CloudJob" /> to the Azure Batch service.
 26        /// </summary>
 27        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 28        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 29        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 30        /// <remarks>
 31        /// <para>If the <see cref="CloudJob"/> already exists on the Batch service, its properties are replaced by the 
 32        /// <para>The commit operation runs asynchronously.</para>
 33        /// </remarks>
 34        public async System.Threading.Tasks.Task CommitAsync(
 35            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 36            CancellationToken cancellationToken = default(CancellationToken))
 37        {
 38            // first forbid actions during commit
 439            this.propertyContainer.IsReadOnly = true;
 40
 41            // craft the behavior manager for this call
 442            BehaviorManager behaveMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 43
 44            // hold the tpl task for the server call
 45            System.Threading.Tasks.Task asyncTask;
 46
 447            if (BindingState.Unbound == this.propertyContainer.BindingState) // unbound commit
 48            {
 49                // take all property changes and create a job
 450                Models.JobAddParameter protoJob = this.GetTransportObject();
 51
 11252                asyncTask = this.parentBatchClient.ProtocolLayer.AddJob(protoJob, behaveMgr, cancellationToken);
 53            }
 10854            else
 10855            {
 10856                Models.MetadataItem[] modelMetadata = UtilitiesInternal.ConvertToProtocolArray(this.Metadata);
 10857                Models.JobConstraints modelJobConstraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints
 10858                Models.PoolInformation modelPoolInformation = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolInfor
 10859
 10860                asyncTask = this.parentBatchClient.ProtocolLayer.UpdateJob(
 10861                    this.Id,
 10862                    this.Priority,
 10863                    UtilitiesInternal.MapNullableEnum<Common.OnAllTasksComplete, Models.OnAllTasksComplete>(this.OnAllTa
 10864                    modelPoolInformation,
 10865                    modelJobConstraints,
 10866                    modelMetadata,
 10867                    behaveMgr,
 10868                    cancellationToken);
 10869            }
 10870
 11271            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 11072        }
 10873
 10874        /// <summary>
 10875        /// Commits this <see cref="CloudJob" /> to the Azure Batch service.
 10876        /// </summary>
 10877        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 10878        /// <remarks>
 79        /// <para>If the <see cref="CloudJob"/> already exists on the Batch service, its properties are replaced by the 
 101680        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="CommitAsync"/>.</para>
 81        /// </remarks>
 101682        public void Commit(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 101683        {
 101784            Task asyncTask = CommitAsync(additionalBehaviors);
 101785            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 101786        }
 151787
 101688        /// <summary>
 101689        /// Commits all pending changes to this <see cref="CloudJob" /> to the Azure Batch service.
 101690        /// </summary>
 101691        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 101692        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 101693        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 101694        /// <remarks>
 101695        /// <para>
 101696        /// Updates an existing <see cref="CloudJob"/> on the Batch service by replacing its properties with the propert
 101697        /// Unchanged properties are ignored.
 101698        /// All changes since the last time this entity was retrieved from the Batch service (either via <see cref="Refr
 101699        /// or <see cref="JobOperations.ListJobs"/>) are applied.
 1016100        /// Properties which are explicitly set to null will cause an exception because the Batch service does not suppo
 1016101        /// If you need to set a property to null, use <see cref="Commit"/>.
 1016102        /// </para>
 1531103        /// <para>This operation runs asynchronously.</para>
 1016104        /// </remarks>
 1016105        public async Task CommitChangesAsync(
 1016106            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 1016107            CancellationToken cancellationToken = default(CancellationToken))
 1016108        {
 1024109            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 1016110
 1516111            // first forbid actions during patch
 1023112            this.propertyContainer.IsReadOnly = true;
 1016113
 1016114            // craft the behavior manager for this call
 1543115            BehaviorManager behaveMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 1016116
 1023117            Models.MetadataItem[] modelMetadata = this.propertyContainer.MetadataProperty.
 1023118                GetTransportObjectIfChanged<MetadataItem, Models.MetadataItem>();
 1531119            Models.JobConstraints modelJobConstraints = this.propertyContainer.ConstraintsProperty.
 1023120                GetTransportObjectIfChanged<JobConstraints, Models.JobConstraints>();
 1023121            Models.PoolInformation modelPoolInformation = this.propertyContainer.PoolInformationProperty.
 1023122                GetTransportObjectIfChanged<PoolInformation, Models.PoolInformation>();
 1022123            int? priority = this.propertyContainer.PriorityProperty.GetIfChangedOrNull();
 1016124
 1022125            Task asyncTask = this.parentBatchClient.ProtocolLayer.PatchJob(
 1022126                this.Id,
 1022127                priority,
 1022128                UtilitiesInternal.MapNullableEnum<Common.OnAllTasksComplete, Models.OnAllTasksComplete>(this.OnAllTasksC
 1022129                modelPoolInformation,
 1022130                modelJobConstraints,
 1522131                modelMetadata,
 1022132                behaveMgr,
 1022133                cancellationToken);
 1016134
 1022135            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 1022136        }
 1016137
 1016138        /// <summary>
 1016139        /// Commits all pending changes to this <see cref="CloudJob" /> to the Azure Batch service.
 1016140        /// </summary>
 1016141        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1016142        /// <remarks>
 1523143        /// <para>
 1016144        /// Updates an existing <see cref="CloudJob"/> on the Batch service by replacing its properties with the propert
 1016145        /// Unchanged properties are ignored.
 1016146        /// All changes since the last time this entity was retrieved from the Batch service (either via <see cref="Refr
 1016147        /// or <see cref="JobOperations.ListJobs"/>) are applied.
 1016148        /// Properties which are explicitly set to null will cause an exception because the Batch service does not suppo
 1016149        /// If you need to set a property to null, use <see cref="Commit"/>.
 1016150        /// </para>
 1016151        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="CommitChangesAsync"/>.</pa
 1016152        /// </remarks>
 1016153        public void CommitChanges(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 1016154        {
 1024155            Task asyncTask = this.CommitChangesAsync(additionalBehaviors);
 1024156            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 1022157        }
 1016158
 1016159        /// <summary>
 1016160        /// Adds a single task to this <see cref="CloudJob"/>.  To add multiple tasks,
 1016161        /// use <see cref="JobOperations.AddTaskAsync(string,IEnumerable{CloudTask},BatchClientParallelOptions,Concurren
 1016162        /// </summary>
 1016163        /// <param name="taskToAdd">The <see cref="CloudTask"/> to add.</param>
 1016164        /// <param name="allFileStagingArtifacts">An optional collection to customize and receive information about the 
 1016165        /// For more information see <see cref="IFileStagingArtifact"/>.</param>
 1016166        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1521167        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 1016168        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 1016169        /// <remarks>
 1016170        /// <para>
 1016171        /// Each call to this method incurs a request to the Batch service. Therefore, using this method to add
 1016172        /// multiple tasks is less efficient than using a bulk add method, and can incur HTTP connection restrictions.
 1016173        /// If you are performing many of these operations in parallel and are seeing client side timeouts (a <see cref=
 1016174        /// http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.defaultconnectionlimit%28v=vs.110%29.
 1016175        /// or use
 1016176        /// <see cref="JobOperations.AddTaskAsync(string,IEnumerable{CloudTask},BatchClientParallelOptions,ConcurrentBag
 1016177        /// </para>
 1016178        /// <para>The add task operation runs asynchronously.</para>
 179        /// </remarks>
 180        public async System.Threading.Tasks.Task AddTaskAsync(
 181            CloudTask taskToAdd,
 182            ConcurrentDictionary<Type, IFileStagingArtifact> allFileStagingArtifacts = null,
 183            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 184            CancellationToken cancellationToken = default(CancellationToken))
 185        {
 7186            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 187
 188            // craft the behavior manager for this call
 7189            BehaviorManager behaveMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 190
 7191            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.JobOperations.AddTaskAsyncImpl(this.Id, taskT
 108192
 115193            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 115194        }
 195
 108196        /// <summary>
 108197        /// Adds a single task to this <see cref="CloudJob"/>.  To add multiple tasks,
 108198        /// use <see cref="JobOperations.AddTask(string,IEnumerable{CloudTask},BatchClientParallelOptions,ConcurrentBag{
 108199        /// </summary>
 200        /// <param name="taskToAdd">The <see cref="CloudTask"/> to add.</param>
 1015201        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1015202        /// <returns>A collection of information about the file staging process (see <see cref="CloudTask.FilesToStage"/
 1015203        /// For more information see <see cref="IFileStagingArtifact"/>.</returns>
 1015204        /// <remarks>
 205        /// <para>
 1015206        /// Each call to this method incurs a request to the Batch service. Therefore, using this method to add
 1015207        /// multiple tasks is less efficient than using a bulk add method, and can incur HTTP connection restrictions.
 1015208        /// If you are performing many of these operations in parallel and are seeing client side timeouts (a <see cref=
 1015209        /// http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.defaultconnectionlimit%28v=vs.110%29.
 210        /// or use
 211        /// <see cref="JobOperations.AddTask(string,IEnumerable{CloudTask},BatchClientParallelOptions,ConcurrentBag{Conc
 212        /// </para>
 213        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="AddTaskAsync(CloudTask, Co
 214        /// </remarks>
 215        public ConcurrentDictionary<Type, IFileStagingArtifact> AddTask(CloudTask taskToAdd, IEnumerable<BatchClientBeha
 216        {
 7217            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 218
 7219            ConcurrentDictionary<Type, IFileStagingArtifact> allFileStagingArtifacts = new ConcurrentDictionary<Type, IF
 220
 7221            Task asyncTask = AddTaskAsync(taskToAdd, allFileStagingArtifacts, additionalBehaviors);
 7222            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 1212223
 7224            return allFileStagingArtifacts;
 225        }
 226
 227        /// <summary>
 228        /// Adds tasks to a job.
 229        /// </summary>
 230        /// <param name="tasksToAdd">The <see cref="CloudTask"/>s to add.</param>
 231        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 232        /// <param name="parallelOptions">
 233        /// Controls the number of simultaneous parallel AddTaskCollection requests issued to the Batch service.  Each A
 234        /// <see cref="Constants.MaxTasksInSingleAddTaskCollectionRequest"/> tasks in it.
 1205235        /// Also controls the cancellation token for the operation.
 236        /// If omitted, the default is used (see <see cref="BatchClientParallelOptions"/>.)
 237        /// </param>
 52238        /// <param name="fileStagingArtifacts">An optional collection to receive information about the file staging proc
 51239        /// An entry is added to the <see cref="ConcurrentBag{T}"/> for each set of tasks grouped for submission to the 
 240        /// Unlike single-task adds, you cannot use this parameter to customize the file staging process.
 241        /// For more information about the format of each entry, see <see cref="IFileStagingArtifact"/>.</param>
 242        /// <param name="timeout">The amount of time after which the operation times out.</param>
 243        /// <returns>A <see cref="System.Threading.Tasks.Task"/> object that represents the asynchronous operation.</ret
 244        /// <remarks>
 245        /// <para>The add task operation runs asynchronously.</para>
 246        /// <para>This method is not atomic; that is, it is possible for the method to start adding tasks and
 1208247        /// then fail. The collection of tasks to add is broken down into chunks of size at most <see cref="Constants.Ma
 95248        /// and an AddTaskCollection request is issued for each chunk.  Requests may be issued in parallel according to
 249        /// the <paramref name="parallelOptions"/>.</para>
 250        /// <para>Issuing a large number of simultaneous requests to the Batch service can incur HTTP connection restric
 251        /// If you are performing many of these operations in parallel (or have specified a large MaxDegreeOfParallelism
 252        /// the parallelOptions) and are seeing client side timeouts (a <see cref="TaskCanceledException"/>), please see
 253        /// http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.defaultconnectionlimit%28v=vs.110%29.
 254        /// <para>The progress of the operation in the face of errors is determined by <see cref="AddTaskCollectionResul
 255        /// You do not normally need to specify this behavior, as the Batch client uses a default which works in normal 
 1002256        /// If you do want to customize this behavior, specify an AddTaskCollectionResultHandler in the <see cref="Custo
 257        /// or <paramref name="additionalBehaviors"/> collections.</para>
 258        /// </remarks>
 259        /// <exception cref="ParallelOperationsException">Thrown if one or more requests to the Batch service fail.</exc
 260        public async Task AddTaskAsync(
 261            IEnumerable<CloudTask> tasksToAdd,
 262            BatchClientParallelOptions parallelOptions = null,
 263            ConcurrentBag<ConcurrentDictionary<Type, IFileStagingArtifact>> fileStagingArtifacts = null,
 1207264            TimeSpan? timeout = null,
 111265            IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 266        {
 0267            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 268
 269            // craft the behavior manager for this call
 0270            BehaviorManager behaveMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 271
 0272            Task asyncTask = this.parentBatchClient.JobOperations.AddTaskAsyncImpl(this.Id, tasksToAdd, parallelOptions,
 1001273
 0274            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 0275        }
 276
 277        /// <summary>
 278        /// Adds tasks to a job.
 279        /// </summary>
 280        /// <param name="tasksToAdd">The <see cref="CloudTask"/>s to add.</param>
 1001281        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 282        /// <param name="parallelOptions">
 283        /// Controls the number of simultaneous parallel AddTaskCollection requests issued to the Batch service.  Each A
 284        /// <see cref="Constants.MaxTasksInSingleAddTaskCollectionRequest"/> tasks in it.
 285        /// Also controls the cancellation token for the operation.
 286        /// If omitted, the default is used (see <see cref="BatchClientParallelOptions"/>.)
 287        /// </param>
 288        /// <param name="fileStagingArtifacts">An optional collection to receive information about the file staging proc
 1229289        /// An entry is added to the <see cref="ConcurrentBag{T}"/> for each set of tasks grouped for submission to the 
 119290        /// Unlike single-task adds, you cannot use this parameter to customize the file staging process.
 291        /// For more information about the format of each entry, see <see cref="IFileStagingArtifact"/>.</param>
 292        /// <param name="timeout">The amount of time after which the operation times out.</param>
 293        /// <remarks>
 294        /// <para>This is a blocking operation; for a non-blocking equivalent, see <see cref="AddTaskAsync(IEnumerable{C
 295        /// <para>This method is not atomic; that is, it is possible for the method to start adding tasks and
 296        /// then fail. The collection of tasks to add is broken down into chunks of size at most <see cref="Constants.Ma
 297        /// and an AddTaskCollection request is issued for each chunk.  Requests may be issued in parallel according to
 1211298        /// the <paramref name="parallelOptions"/>.</para>
 98299        /// <para>Issuing a large number of simultaneous requests to the Batch service can incur HTTP connection restric
 300        /// If you are performing many of these operations in parallel (or have specified a large MaxDegreeOfParallelism
 301        /// the parallelOptions) and are seeing client side timeouts (a <see cref="TaskCanceledException"/>), please see
 302        /// http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.defaultconnectionlimit%28v=vs.110%29.
 303        /// <para>The progress of the operation in the face of errors is determined by <see cref="AddTaskCollectionResul
 304        /// You do not normally need to specify this behavior, as the Batch client uses a default which works in normal 
 305        /// If you do want to customize this behavior, specify an AddTaskCollectionResultHandler in the <see cref="Custo
 306        /// or <paramref name="additionalBehaviors"/> collections.</para>
 307        /// </remarks>
 1207308        /// <exception cref="ParallelOperationsException">Thrown if one or more requests to the Batch service fail.</exc
 105309        public void AddTask(
 310            IEnumerable<CloudTask> tasksToAdd,
 311            BatchClientParallelOptions parallelOptions = null,
 312            ConcurrentBag<ConcurrentDictionary<Type, IFileStagingArtifact>> fileStagingArtifacts = null,
 313            TimeSpan? timeout = null,
 314            IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 315        {
 0316            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 317
 1205318            Task asyncTask = this.AddTaskAsync(tasksToAdd, parallelOptions, fileStagingArtifacts, timeout, additionalBeh
 99319            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0320        }
 321
 322        /// <summary>
 323        /// Enumerates the <see cref="CloudTask">tasks</see> of this <see cref="CloudJob"/>.
 324        /// </summary>
 325        /// <param name="detailLevel">A <see cref="DetailLevel"/> used for filtering the list and for controlling which 
 326        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1001327        /// <returns>An <see cref="IPagedEnumerable{CloudTask}"/> that can be used to enumerate tasks asynchronously or 
 328        /// <remarks>This method returns immediately; the tasks are retrieved from the Batch service only when the colle
 329        /// Retrieval is non-atomic; tasks are retrieved in pages during enumeration of the collection.</remarks>
 330        public IPagedEnumerable<CloudTask> ListTasks(DetailLevel detailLevel = null, IEnumerable<BatchClientBehavior> ad
 331        {
 332            // throw if if this object is unbound
 0333            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 334
 1210335            // craft the behavior manager for this call
 0336            BehaviorManager behaveMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 337
 51338            IPagedEnumerable<CloudTask> ienumAsync = this.parentBatchClient.JobOperations.ListTasksImpl(this.Id, behaveM
 50339
 0340            return ienumAsync;
 341        }
 342
 343        /// <summary>
 344        /// Gets the specified <see cref="CloudTask"/>.
 345        /// </summary>
 346        /// <param name="taskId">The id of the task to get.</param>
 1205347        /// <param name="detailLevel">A <see cref="DetailLevel"/> used for controlling which properties are retrieved fr
 99348        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 349        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 350        /// <returns>A <see cref="CloudTask"/> containing information about the specified Azure Batch task.</returns>
 351        /// <remarks>The get task operation runs asynchronously.</remarks>
 352        public async System.Threading.Tasks.Task<CloudTask> GetTaskAsync(
 353            string taskId,
 354            DetailLevel detailLevel = null,
 355            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 356            CancellationToken cancellationToken = default(CancellationToken))
 1215357        {
 113358            // throw if if this object is unbound
 0359            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 360
 361            // craft the behavior manager for this call
 0362            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel);
 363
 0364            Task<CloudTask> asyncTask = this.parentBatchClient.JobOperations.GetTaskAsyncImpl(this.Id, taskId, bhMgr, ca
 0365            CloudTask theTask = await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 366
 0367            return theTask;
 0368        }
 369
 1207370        /// <summary>
 93371        /// Gets the specified <see cref="CloudTask"/>.
 372        /// </summary>
 373        /// <param name="taskId">The id of the task to get.</param>
 374        /// <param name="detailLevel">A <see cref="DetailLevel"/> used for controlling which properties are retrieved fr
 375        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 376        /// <returns>A <see cref="CloudTask"/> containing information about the specified Azure Batch task.</returns>
 377        /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="GetTaskAsync"/>.</remar
 378        public CloudTask GetTask(
 1212379                                string taskId,
 125380                                DetailLevel detailLevel = null,
 381                                IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 382        {
 0383            Task<CloudTask> asyncTask = GetTaskAsync(taskId, detailLevel, additionalBehaviors);
 0384            CloudTask cloudTask = asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 385
 0386            return cloudTask;
 387        }
 388
 389        /// <summary>
 390        /// Enables this <see cref="CloudJob"/>, allowing new tasks to run.
 1001391        /// </summary>
 392        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 393        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 394        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 395        /// <remarks>The enable operation runs asynchronously.</remarks>
 396        public System.Threading.Tasks.Task EnableAsync(IEnumerable<BatchClientBehavior> additionalBehaviors = null, Canc
 397        {
 398            // throw if if this object is unbound
 0399            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 400
 401            // craft the behavior manager for this call
 0402            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 1001403
 404            // start call
 0405            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.EnableJob(this.Id, bhMgr, cance
 406
 0407            return asyncTask;
 408        }
 409
 410        /// <summary>
 411        /// Enables this <see cref="CloudJob"/>, allowing new tasks to run.
 412        /// </summary>
 413        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 414        /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="EnableAsync"/>.</remark
 1212415        public void Enable(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 111416        {
 0417            Task asyncTask = EnableAsync(additionalBehaviors);
 0418            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0419        }
 420
 421        /// <summary>
 422        /// Disables this <see cref="CloudJob"/>.  Disabled jobs do not run new tasks, but may be re-enabled later.
 423        /// </summary>
 1001424        /// <param name="disableJobOption">Specifies what to do with active tasks associated with the job.</param>
 425        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 426        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 427        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 428        /// <remarks>The disable operation runs asynchronously.</remarks>
 429        public System.Threading.Tasks.Task DisableAsync(
 430            Common.DisableJobOption disableJobOption,
 431            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 1001432            CancellationToken cancellationToken = default(CancellationToken))
 433        {
 434            // throw if if this object is unbound
 0435            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 436
 437            // craft the behavior manager for this call
 0438            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 439
 440            // start call
 0441            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.DisableJob(this.Id, disableJobO
 442
 0443            return asyncTask;
 444        }
 1001445
 446        /// <summary>
 447        /// Disables this <see cref="CloudJob"/>.  Disabled jobs do not run new tasks, but may be re-enabled later.
 448        /// </summary>
 449        /// <param name="disableJobOption">Specifies what to do with active tasks associated with the job.</param>
 450        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 451        /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="DisableAsync"/>.</remar
 452        public void Disable(Common.DisableJobOption disableJobOption, IEnumerable<BatchClientBehavior> additionalBehavio
 1003453        {
 0454            Task asyncTask = DisableAsync(disableJobOption, additionalBehaviors);
 0455            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0456        }
 457
 458        /// <summary>
 459        /// Terminates this <see cref="CloudJob"/>, marking it as completed.
 460        /// </summary>
 461        /// <param name="terminateReason">The text you want to appear as the job's <see cref="JobExecutionInformation.Te
 462        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 463        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 1206464        /// <returns>A <see cref="System.Threading.Tasks.Task"/> object that represents the asynchronous operation.</ret
 108465        /// <remarks>The terminate operation runs asynchronously.</remarks>
 466        public System.Threading.Tasks.Task TerminateAsync(
 467            string terminateReason = null,
 468            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 469            CancellationToken cancellationToken = default(CancellationToken))
 470        {
 471            // throw if if this object is unbound
 0472            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 473
 0474            // craft the behavior manager for this call
 0475            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 476
 477            // start call
 0478            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.TerminateJob(this.Id, terminate
 0479
 2480            return asyncTask;
 481        }
 482
 483        /// <summary>
 484        /// Terminates this <see cref="CloudJob"/>, marking it as completed.
 485        /// </summary>
 486        /// <param name="terminateReason">The text you want to appear as the job's <see cref="JobExecutionInformation.Te
 487        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 488        /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="TerminateAsync"/>.</rem
 489        public void Terminate(string terminateReason = null, IEnumerable<BatchClientBehavior> additionalBehaviors = null
 490        {
 0491            Task asyncTask = TerminateAsync(terminateReason, additionalBehaviors);
 104492            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 104493        }
 104494
 150495        /// <summary>
 104496        /// Deletes this <see cref="CloudJob" />.
 104497        /// </summary>
 152498        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 156499        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 153500        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 104501        /// <remarks>
 153502        /// <para>The delete operation requests that the job be deleted.  The request puts the job in the <see cref="Com
 104503        /// The Batch service will stop any running tasks and perform the actual job deletion without any further client
 104504        /// <para>The delete operation runs asynchronously.</para>
 161505        /// </remarks>
 104506        public System.Threading.Tasks.Task DeleteAsync(IEnumerable<BatchClientBehavior> additionalBehaviors = null, Canc
 104507        {
 104508            // throw if if this object is unbound
 0509            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 104510
 511            // craft the behavior manager for this call
 0512            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 513
 514            // start call
 0515            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.DeleteJob(this.Id, bhMgr, cance
 516
 0517            return asyncTask;
 518        }
 519
 520        /// <summary>
 521        /// Deletes this <see cref="CloudJob" />.
 522        /// </summary>
 523        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 524        /// <remarks>
 525        /// <para>The delete operation requests that the job be deleted.  The request puts the job in the <see cref="Com
 526        /// The Batch service will stop any running tasks and perform the actual job deletion without any further client
 527        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="DeleteAsync"/>.</para>
 528        /// </remarks>
 529        public void Delete(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 530        {
 0531            Task asyncTask = DeleteAsync(additionalBehaviors);
 0532            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0533        }
 534
 535        /// <summary>
 536        /// Refreshes the current <see cref="CloudJob"/>.
 537        /// </summary>
 538        /// <param name="detailLevel">The detail level for the refresh.  If a detail level which omits the <see cref="Id
 539        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 540        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 541        /// <returns>A <see cref="Task"/> representing the asynchronous refresh operation.</returns>
 542        public async System.Threading.Tasks.Task RefreshAsync(
 543            DetailLevel detailLevel = null,
 544            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 545            CancellationToken cancellationToken = default(CancellationToken))
 546        {
 547            // create the behavior managaer
 2548            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel);
 549
 550            // start operation
 2551            System.Threading.Tasks.Task<AzureOperationResponse<Models.CloudJob, Models.JobGetHeaders>> asyncTask =
 2552                this.parentBatchClient.ProtocolLayer.GetJob(this.Id, bhMgr, cancellationToken);
 553
 2554            AzureOperationResponse<Models.CloudJob, Models.JobGetHeaders> response = await asyncTask.ConfigureAwait(cont
 555
 556            // get job from response
 1557            Models.CloudJob newProtocolJob = response.Body;
 558
 1559            PropertyContainer container = new PropertyContainer(newProtocolJob);
 560
 561            // immediately available to all threads
 1562            this.propertyContainer = container;
 1563        }
 564
 565        /// <summary>
 566        /// Refreshes the current <see cref="CloudJob"/>.
 567        /// </summary>
 568        /// <param name="detailLevel">The detail level for the refresh.  If a detail level which omits the <see cref="Id
 569        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 570        public void Refresh(DetailLevel detailLevel = null, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 571        {
 0572            Task asyncTask = RefreshAsync(detailLevel, additionalBehaviors);
 0573            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0574        }
 575
 576        /// <summary>
 577        /// Gets the task counts for the job.
 578        /// </summary>
 579        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 580        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 581        /// <remarks>The get job task counts operation runs asynchronously.</remarks>
 582        /// <returns>A <see cref="TaskCounts"/> object containing the task counts for the job.</returns>
 583        public async Task<TaskCounts> GetTaskCountsAsync(
 584            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 585            CancellationToken cancellationToken = default(CancellationToken))
 586        {
 587            // set up behavior manager
 0588            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel: null);
 0589            TaskCounts counts = await this.parentBatchClient.JobOperations.GetJobTaskCountsAsyncImpl(this.Id, bhMgr, can
 590
 0591            return counts;
 0592        }
 593
 594        /// <summary>
 595        /// Gets the task counts for the job.
 596        /// </summary>
 597        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 598        /// <returns>A <see cref="TaskCounts"/> object containing the task counts for the job</returns>
 599        /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="GetTaskCountsAsync"/>.<
 600        public TaskCounts GetTaskCounts(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 601        {
 0602            TaskCounts result = GetTaskCountsAsync(additionalBehaviors).WaitAndUnaggregateException(this.CustomBehaviors
 0603            return result;
 604        }
 605
 606        #endregion // CloudJob
 607
 608    }
 609}

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CloudJob.cs

#LineLine coverage
 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
 13namespace 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    /// An Azure Batch job.
 22    /// </summary>
 23    public partial class CloudJob : ITransportObjectProvider<Models.JobAddParameter>, IInheritedBehaviors, IPropertyMeta
 24    {
 25        private class PropertyContainer : PropertyCollection
 26        {
 27            public readonly PropertyAccessor<IList<EnvironmentSetting>> CommonEnvironmentSettingsProperty;
 28            public readonly PropertyAccessor<JobConstraints> ConstraintsProperty;
 29            public readonly PropertyAccessor<DateTime?> CreationTimeProperty;
 30            public readonly PropertyAccessor<string> DisplayNameProperty;
 31            public readonly PropertyAccessor<string> ETagProperty;
 32            public readonly PropertyAccessor<JobExecutionInformation> ExecutionInformationProperty;
 33            public readonly PropertyAccessor<string> IdProperty;
 34            public readonly PropertyAccessor<JobManagerTask> JobManagerTaskProperty;
 35            public readonly PropertyAccessor<JobPreparationTask> JobPreparationTaskProperty;
 36            public readonly PropertyAccessor<JobReleaseTask> JobReleaseTaskProperty;
 37            public readonly PropertyAccessor<DateTime?> LastModifiedProperty;
 38            public readonly PropertyAccessor<IList<MetadataItem>> MetadataProperty;
 39            public readonly PropertyAccessor<JobNetworkConfiguration> NetworkConfigurationProperty;
 40            public readonly PropertyAccessor<Common.OnAllTasksComplete?> OnAllTasksCompleteProperty;
 41            public readonly PropertyAccessor<Common.OnTaskFailure?> OnTaskFailureProperty;
 42            public readonly PropertyAccessor<PoolInformation> PoolInformationProperty;
 43            public readonly PropertyAccessor<Common.JobState?> PreviousStateProperty;
 44            public readonly PropertyAccessor<DateTime?> PreviousStateTransitionTimeProperty;
 45            public readonly PropertyAccessor<int?> PriorityProperty;
 46            public readonly PropertyAccessor<Common.JobState?> StateProperty;
 47            public readonly PropertyAccessor<DateTime?> StateTransitionTimeProperty;
 48            public readonly PropertyAccessor<JobStatistics> StatisticsProperty;
 49            public readonly PropertyAccessor<string> UrlProperty;
 50            public readonly PropertyAccessor<bool?> UsesTaskDependenciesProperty;
 51
 052            public PropertyContainer() : base(BindingState.Unbound)
 53            {
 054                this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(C
 055                this.ConstraintsProperty = this.CreatePropertyAccessor<JobConstraints>(nameof(Constraints), BindingAcces
 056                this.CreationTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(CreationTime), BindingAccess.N
 057                this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read |
 058                this.ETagProperty = this.CreatePropertyAccessor<string>(nameof(ETag), BindingAccess.None);
 059                this.ExecutionInformationProperty = this.CreatePropertyAccessor<JobExecutionInformation>(nameof(Executio
 060                this.IdProperty = this.CreatePropertyAccessor<string>(nameof(Id), BindingAccess.Read | BindingAccess.Wri
 061                this.JobManagerTaskProperty = this.CreatePropertyAccessor<JobManagerTask>(nameof(JobManagerTask), Bindin
 062                this.JobPreparationTaskProperty = this.CreatePropertyAccessor<JobPreparationTask>(nameof(JobPreparationT
 063                this.JobReleaseTaskProperty = this.CreatePropertyAccessor<JobReleaseTask>(nameof(JobReleaseTask), Bindin
 064                this.LastModifiedProperty = this.CreatePropertyAccessor<DateTime?>(nameof(LastModified), BindingAccess.N
 065                this.MetadataProperty = this.CreatePropertyAccessor<IList<MetadataItem>>(nameof(Metadata), BindingAccess
 066                this.NetworkConfigurationProperty = this.CreatePropertyAccessor<JobNetworkConfiguration>(nameof(NetworkC
 067                this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor<Common.OnAllTasksComplete?>(nameof(OnAllTa
 068                this.OnTaskFailureProperty = this.CreatePropertyAccessor<Common.OnTaskFailure?>(nameof(OnTaskFailure), B
 069                this.PoolInformationProperty = this.CreatePropertyAccessor<PoolInformation>(nameof(PoolInformation), Bin
 070                this.PreviousStateProperty = this.CreatePropertyAccessor<Common.JobState?>(nameof(PreviousState), Bindin
 071                this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(PreviousStateTr
 072                this.PriorityProperty = this.CreatePropertyAccessor<int?>(nameof(Priority), BindingAccess.Read | Binding
 073                this.StateProperty = this.CreatePropertyAccessor<Common.JobState?>(nameof(State), BindingAccess.None);
 074                this.StateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(StateTransitionTime), B
 075                this.StatisticsProperty = this.CreatePropertyAccessor<JobStatistics>(nameof(Statistics), BindingAccess.N
 076                this.UrlProperty = this.CreatePropertyAccessor<string>(nameof(Url), BindingAccess.None);
 077                this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor<bool?>(nameof(UsesTaskDependencies), Bin
 078            }
 79
 080            public PropertyContainer(Models.CloudJob protocolObject) : base(BindingState.Bound)
 81            {
 082                this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor(
 083                    EnvironmentSetting.ConvertFromProtocolCollectionAndFreeze(protocolObject.CommonEnvironmentSettings),
 084                    nameof(CommonEnvironmentSettings),
 085                    BindingAccess.Read);
 086                this.ConstraintsProperty = this.CreatePropertyAccessor(
 087                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new JobConstraints(o)),
 088                    nameof(Constraints),
 089                    BindingAccess.Read | BindingAccess.Write);
 090                this.CreationTimeProperty = this.CreatePropertyAccessor(
 091                    protocolObject.CreationTime,
 092                    nameof(CreationTime),
 093                    BindingAccess.Read);
 094                this.DisplayNameProperty = this.CreatePropertyAccessor(
 095                    protocolObject.DisplayName,
 096                    nameof(DisplayName),
 097                    BindingAccess.Read);
 098                this.ETagProperty = this.CreatePropertyAccessor(
 099                    protocolObject.ETag,
 0100                    nameof(ETag),
 0101                    BindingAccess.Read);
 0102                this.ExecutionInformationProperty = this.CreatePropertyAccessor(
 0103                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExecutionInfo, o => new JobExecutionInfor
 0104                    nameof(ExecutionInformation),
 0105                    BindingAccess.Read);
 0106                this.IdProperty = this.CreatePropertyAccessor(
 0107                    protocolObject.Id,
 0108                    nameof(Id),
 0109                    BindingAccess.Read);
 0110                this.JobManagerTaskProperty = this.CreatePropertyAccessor(
 0111                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobManagerTask, o => new JobManagerTask(o
 0112                    nameof(JobManagerTask),
 0113                    BindingAccess.Read);
 0114                this.JobPreparationTaskProperty = this.CreatePropertyAccessor(
 0115                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobPreparationTask, o => new JobPreparati
 0116                    nameof(JobPreparationTask),
 0117                    BindingAccess.Read);
 0118                this.JobReleaseTaskProperty = this.CreatePropertyAccessor(
 0119                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobReleaseTask, o => new JobReleaseTask(o
 0120                    nameof(JobReleaseTask),
 0121                    BindingAccess.Read);
 0122                this.LastModifiedProperty = this.CreatePropertyAccessor(
 0123                    protocolObject.LastModified,
 0124                    nameof(LastModified),
 0125                    BindingAccess.Read);
 0126                this.MetadataProperty = this.CreatePropertyAccessor(
 0127                    MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata),
 0128                    nameof(Metadata),
 0129                    BindingAccess.Read | BindingAccess.Write);
 0130                this.NetworkConfigurationProperty = this.CreatePropertyAccessor(
 0131                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NetworkConfiguration, o => new JobNetwork
 0132                    nameof(NetworkConfiguration),
 0133                    BindingAccess.Read);
 0134                this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor(
 0135                    UtilitiesInternal.MapNullableEnum<Models.OnAllTasksComplete, Common.OnAllTasksComplete>(protocolObje
 0136                    nameof(OnAllTasksComplete),
 0137                    BindingAccess.Read | BindingAccess.Write);
 0138                this.OnTaskFailureProperty = this.CreatePropertyAccessor(
 0139                    UtilitiesInternal.MapNullableEnum<Models.OnTaskFailure, Common.OnTaskFailure>(protocolObject.OnTaskF
 0140                    nameof(OnTaskFailure),
 0141                    BindingAccess.Read);
 0142                this.PoolInformationProperty = this.CreatePropertyAccessor(
 0143                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PoolInfo, o => new PoolInformation(o)),
 0144                    nameof(PoolInformation),
 0145                    BindingAccess.Read | BindingAccess.Write);
 0146                this.PreviousStateProperty = this.CreatePropertyAccessor(
 0147                    UtilitiesInternal.MapNullableEnum<Models.JobState, Common.JobState>(protocolObject.PreviousState),
 0148                    nameof(PreviousState),
 0149                    BindingAccess.Read);
 0150                this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor(
 0151                    protocolObject.PreviousStateTransitionTime,
 0152                    nameof(PreviousStateTransitionTime),
 0153                    BindingAccess.Read);
 0154                this.PriorityProperty = this.CreatePropertyAccessor(
 0155                    protocolObject.Priority,
 0156                    nameof(Priority),
 0157                    BindingAccess.Read | BindingAccess.Write);
 0158                this.StateProperty = this.CreatePropertyAccessor(
 0159                    UtilitiesInternal.MapNullableEnum<Models.JobState, Common.JobState>(protocolObject.State),
 0160                    nameof(State),
 0161                    BindingAccess.Read);
 0162                this.StateTransitionTimeProperty = this.CreatePropertyAccessor(
 0163                    protocolObject.StateTransitionTime,
 0164                    nameof(StateTransitionTime),
 0165                    BindingAccess.Read);
 0166                this.StatisticsProperty = this.CreatePropertyAccessor(
 0167                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Stats, o => new JobStatistics(o).Freeze()
 0168                    nameof(Statistics),
 0169                    BindingAccess.Read);
 0170                this.UrlProperty = this.CreatePropertyAccessor(
 0171                    protocolObject.Url,
 0172                    nameof(Url),
 0173                    BindingAccess.Read);
 0174                this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor(
 0175                    protocolObject.UsesTaskDependencies,
 0176                    nameof(UsesTaskDependencies),
 0177                    BindingAccess.Read);
 0178            }
 179        }
 180
 181        private PropertyContainer propertyContainer;
 182
 183        private readonly BatchClient parentBatchClient;
 184
 185        #region Constructors
 186
 187        /// <summary>
 188        /// Initializes a new instance of the <see cref="CloudJob"/> class.
 189        /// </summary>
 190        /// <param name='parentBatchClient'>The parent <see cref="BatchClient"/> to use.</param>
 191        /// <param name='baseBehaviors'>The base behaviors to use.</param>
 0192        internal CloudJob(
 0193            BatchClient parentBatchClient,
 0194            IEnumerable<BatchClientBehavior> baseBehaviors)
 195        {
 0196            this.propertyContainer = new PropertyContainer();
 0197            this.parentBatchClient = parentBatchClient;
 0198            InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors);
 0199        }
 200
 0201        internal CloudJob(
 0202            BatchClient parentBatchClient,
 0203            Models.CloudJob protocolObject,
 0204            IEnumerable<BatchClientBehavior> baseBehaviors)
 205        {
 0206            this.parentBatchClient = parentBatchClient;
 0207            InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors);
 0208            this.propertyContainer = new PropertyContainer(protocolObject);
 0209        }
 210
 211        #endregion Constructors
 212
 213        #region IInheritedBehaviors
 214
 215        /// <summary>
 216        /// Gets or sets a list of behaviors that modify or customize requests to the Batch service
 217        /// made via this <see cref="CloudJob"/>.
 218        /// </summary>
 219        /// <remarks>
 220        /// <para>These behaviors are inherited by child objects.</para>
 221        /// <para>Modifications are applied in the order of the collection. The last write wins.</para>
 222        /// </remarks>
 0223        public IList<BatchClientBehavior> CustomBehaviors { get; set; }
 224
 225        #endregion IInheritedBehaviors
 226
 227        #region CloudJob
 228
 229        /// <summary>
 230        /// Gets or sets a list of common environment variable settings. These environment variables are set for all tas
 231        /// in this <see cref="CloudJob"/> (including the Job Manager, Job Preparation and Job Release tasks).
 232        /// </summary>
 233        public IList<EnvironmentSetting> CommonEnvironmentSettings
 234        {
 0235            get { return this.propertyContainer.CommonEnvironmentSettingsProperty.Value; }
 236            set
 237            {
 0238                this.propertyContainer.CommonEnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<E
 0239            }
 240        }
 241
 242        /// <summary>
 243        /// Gets or sets the execution constraints for the job.
 244        /// </summary>
 245        public JobConstraints Constraints
 246        {
 0247            get { return this.propertyContainer.ConstraintsProperty.Value; }
 0248            set { this.propertyContainer.ConstraintsProperty.Value = value; }
 249        }
 250
 251        /// <summary>
 252        /// Gets the creation time of the job.
 253        /// </summary>
 254        public DateTime? CreationTime
 255        {
 0256            get { return this.propertyContainer.CreationTimeProperty.Value; }
 257        }
 258
 259        /// <summary>
 260        /// Gets or sets the display name of the job.
 261        /// </summary>
 262        public string DisplayName
 263        {
 0264            get { return this.propertyContainer.DisplayNameProperty.Value; }
 0265            set { this.propertyContainer.DisplayNameProperty.Value = value; }
 266        }
 267
 268        /// <summary>
 269        /// Gets the ETag for the job.
 270        /// </summary>
 271        public string ETag
 272        {
 0273            get { return this.propertyContainer.ETagProperty.Value; }
 274        }
 275
 276        /// <summary>
 277        /// Gets the execution information for the job.
 278        /// </summary>
 279        public JobExecutionInformation ExecutionInformation
 280        {
 0281            get { return this.propertyContainer.ExecutionInformationProperty.Value; }
 282        }
 283
 284        /// <summary>
 285        /// Gets or sets the id of the job.
 286        /// </summary>
 287        public string Id
 288        {
 0289            get { return this.propertyContainer.IdProperty.Value; }
 0290            set { this.propertyContainer.IdProperty.Value = value; }
 291        }
 292
 293        /// <summary>
 294        /// Gets or sets the Job Manager task. The Job Manager task is launched when the <see cref="CloudJob"/> is start
 295        /// </summary>
 296        public JobManagerTask JobManagerTask
 297        {
 0298            get { return this.propertyContainer.JobManagerTaskProperty.Value; }
 0299            set { this.propertyContainer.JobManagerTaskProperty.Value = value; }
 300        }
 301
 302        /// <summary>
 303        /// Gets or sets the Job Preparation task. The Batch service will run the Job Preparation task on a compute node
 304        /// before starting any tasks of that job on that compute node.
 305        /// </summary>
 306        public JobPreparationTask JobPreparationTask
 307        {
 0308            get { return this.propertyContainer.JobPreparationTaskProperty.Value; }
 0309            set { this.propertyContainer.JobPreparationTaskProperty.Value = value; }
 310        }
 311
 312        /// <summary>
 313        /// Gets or sets the Job Release task. The Batch service runs the Job Release task when the job ends, on each co
 314        /// node where any task of the job has run.
 315        /// </summary>
 316        public JobReleaseTask JobReleaseTask
 317        {
 0318            get { return this.propertyContainer.JobReleaseTaskProperty.Value; }
 0319            set { this.propertyContainer.JobReleaseTaskProperty.Value = value; }
 320        }
 321
 322        /// <summary>
 323        /// Gets the last modified time of the job.
 324        /// </summary>
 325        public DateTime? LastModified
 326        {
 0327            get { return this.propertyContainer.LastModifiedProperty.Value; }
 328        }
 329
 330        /// <summary>
 331        /// Gets or sets a list of name-value pairs associated with the job as metadata.
 332        /// </summary>
 333        public IList<MetadataItem> Metadata
 334        {
 0335            get { return this.propertyContainer.MetadataProperty.Value; }
 336            set
 337            {
 0338                this.propertyContainer.MetadataProperty.Value = ConcurrentChangeTrackedModifiableList<MetadataItem>.Tran
 0339            }
 340        }
 341
 342        /// <summary>
 343        /// Gets or sets the network configuration for the job.
 344        /// </summary>
 345        public JobNetworkConfiguration NetworkConfiguration
 346        {
 0347            get { return this.propertyContainer.NetworkConfigurationProperty.Value; }
 0348            set { this.propertyContainer.NetworkConfigurationProperty.Value = value; }
 349        }
 350
 351        /// <summary>
 352        /// Gets or sets the action the Batch service should take when all tasks in the job are in the <see cref="Common
 353        /// state.
 354        /// </summary>
 355        public Common.OnAllTasksComplete? OnAllTasksComplete
 356        {
 0357            get { return this.propertyContainer.OnAllTasksCompleteProperty.Value; }
 0358            set { this.propertyContainer.OnAllTasksCompleteProperty.Value = value; }
 359        }
 360
 361        /// <summary>
 362        /// Gets or sets the action the Batch service should take when any task in the job fails.
 363        /// </summary>
 364        /// <remarks>
 365        /// A task is considered to have failed if it completes with a non-zero exit code and has exhausted its retry co
 366        /// or if it had a scheduling error.
 367        /// </remarks>
 368        public Common.OnTaskFailure? OnTaskFailure
 369        {
 0370            get { return this.propertyContainer.OnTaskFailureProperty.Value; }
 0371            set { this.propertyContainer.OnTaskFailureProperty.Value = value; }
 372        }
 373
 374        /// <summary>
 375        /// Gets or sets the pool on which the Batch service runs the job's tasks.
 376        /// </summary>
 377        public PoolInformation PoolInformation
 378        {
 0379            get { return this.propertyContainer.PoolInformationProperty.Value; }
 0380            set { this.propertyContainer.PoolInformationProperty.Value = value; }
 381        }
 382
 383        /// <summary>
 384        /// Gets the previous state of the job.
 385        /// </summary>
 386        /// <remarks>
 387        /// If the job is in its initial <see cref="Common.JobState.Active"/> state, the PreviousState property is not d
 388        /// </remarks>
 389        public Common.JobState? PreviousState
 390        {
 0391            get { return this.propertyContainer.PreviousStateProperty.Value; }
 392        }
 393
 394        /// <summary>
 395        /// Gets the time at which the job entered its previous state.
 396        /// </summary>
 397        /// <remarks>
 398        /// If the job is in its initial <see cref="Common.JobState.Active"/> state, the PreviousStateTransitionTime pro
 399        /// is not defined.
 400        /// </remarks>
 401        public DateTime? PreviousStateTransitionTime
 402        {
 0403            get { return this.propertyContainer.PreviousStateTransitionTimeProperty.Value; }
 404        }
 405
 406        /// <summary>
 407        /// Gets or sets the priority of the job. Priority values can range from -1000 to 1000, with -1000 being the low
 408        /// priority and 1000 being the highest priority.
 409        /// </summary>
 410        /// <remarks>
 411        /// The default value is 0.
 412        /// </remarks>
 413        public int? Priority
 414        {
 0415            get { return this.propertyContainer.PriorityProperty.Value; }
 0416            set { this.propertyContainer.PriorityProperty.Value = value; }
 417        }
 418
 419        /// <summary>
 420        /// Gets the current state of the job.
 421        /// </summary>
 422        public Common.JobState? State
 423        {
 0424            get { return this.propertyContainer.StateProperty.Value; }
 425        }
 426
 427        /// <summary>
 428        /// Gets the time at which the job entered its current state.
 429        /// </summary>
 430        public DateTime? StateTransitionTime
 431        {
 0432            get { return this.propertyContainer.StateTransitionTimeProperty.Value; }
 433        }
 434
 435        /// <summary>
 436        /// Gets resource usage statistics for the entire lifetime of the job.
 437        /// </summary>
 438        /// <remarks>
 439        /// This property is populated only if the <see cref="CloudJob"/> was retrieved with an <see cref="ODATADetailLe
 440        /// including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The 
 441        /// service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
 442        /// </remarks>
 443        public JobStatistics Statistics
 444        {
 0445            get { return this.propertyContainer.StatisticsProperty.Value; }
 446        }
 447
 448        /// <summary>
 449        /// Gets the URL of the job.
 450        /// </summary>
 451        public string Url
 452        {
 0453            get { return this.propertyContainer.UrlProperty.Value; }
 454        }
 455
 456        /// <summary>
 457        /// Gets or sets whether tasks in the job can define dependencies on each other.
 458        /// </summary>
 459        /// <remarks>
 460        /// The default value is false.
 461        /// </remarks>
 462        public bool? UsesTaskDependencies
 463        {
 0464            get { return this.propertyContainer.UsesTaskDependenciesProperty.Value; }
 0465            set { this.propertyContainer.UsesTaskDependenciesProperty.Value = value; }
 466        }
 467
 468        #endregion // CloudJob
 469
 470        #region IPropertyMetadata
 471
 472        bool IModifiable.HasBeenModified
 473        {
 0474            get { return this.propertyContainer.HasBeenModified; }
 475        }
 476
 477        bool IReadOnly.IsReadOnly
 478        {
 0479            get { return this.propertyContainer.IsReadOnly; }
 0480            set { this.propertyContainer.IsReadOnly = value; }
 481        }
 482
 483        #endregion //IPropertyMetadata
 484
 485        #region Internal/private methods
 486        /// <summary>
 487        /// Return a protocol object of the requested type.
 488        /// </summary>
 489        /// <returns>The protocol object of the requested type.</returns>
 490        Models.JobAddParameter ITransportObjectProvider<Models.JobAddParameter>.GetTransportObject()
 491        {
 0492            Models.JobAddParameter result = new Models.JobAddParameter()
 0493            {
 0494                CommonEnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.CommonEnvironmentSettings
 0495                Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject(
 0496                DisplayName = this.DisplayName,
 0497                Id = this.Id,
 0498                JobManagerTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobManagerTask, (o) => o.GetTransportO
 0499                JobPreparationTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobPreparationTask, (o) => o.GetTr
 0500                JobReleaseTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobReleaseTask, (o) => o.GetTransportO
 0501                Metadata = UtilitiesInternal.ConvertToProtocolCollection(this.Metadata),
 0502                NetworkConfiguration = UtilitiesInternal.CreateObjectWithNullCheck(this.NetworkConfiguration, (o) => o.G
 0503                OnAllTasksComplete = UtilitiesInternal.MapNullableEnum<Common.OnAllTasksComplete, Models.OnAllTasksCompl
 0504                OnTaskFailure = UtilitiesInternal.MapNullableEnum<Common.OnTaskFailure, Models.OnTaskFailure>(this.OnTas
 0505                PoolInfo = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolInformation, (o) => o.GetTransportObject
 0506                Priority = this.Priority,
 0507                UsesTaskDependencies = this.UsesTaskDependencies,
 0508            };
 509
 0510            return result;
 511        }
 512
 513
 514        #endregion // Internal/private methods
 515    }
 516}

Methods/Properties

CommitAsync()
.ctor()
.ctor(...)
Commit(...)
CommitChangesAsync()
CommitChanges(...)
AddTaskAsync()
.ctor(...)
.ctor(...)
AddTask(...)
get_CustomBehaviors()
get_CommonEnvironmentSettings()
set_CommonEnvironmentSettings(...)
get_Constraints()
set_Constraints(...)
get_CreationTime()
get_DisplayName()
set_DisplayName(...)
AddTaskAsync()
get_ETag()
get_ExecutionInformation()
get_Id()
set_Id(...)
get_JobManagerTask()
set_JobManagerTask(...)
get_JobPreparationTask()
set_JobPreparationTask(...)
AddTask(...)
get_JobReleaseTask()
set_JobReleaseTask(...)
get_LastModified()
ListTasks(...)
get_Metadata()
set_Metadata(...)
get_NetworkConfiguration()
set_NetworkConfiguration(...)
get_OnAllTasksComplete()
set_OnAllTasksComplete(...)
GetTaskAsync()
get_OnTaskFailure()
set_OnTaskFailure(...)
get_PoolInformation()
set_PoolInformation(...)
GetTask(...)
get_PreviousState()
EnableAsync(...)
get_PreviousStateTransitionTime()
get_Priority()
set_Priority(...)
Enable(...)
get_State()
get_StateTransitionTime()
DisableAsync(...)
get_Statistics()
get_Url()
Disable(...)
get_UsesTaskDependencies()
set_UsesTaskDependencies(...)
TerminateAsync(...)
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)
Terminate(...)
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobAddParameter>.GetTransportObject()
DeleteAsync(...)
Delete(...)
RefreshAsync()
Refresh(...)
GetTaskCountsAsync()
GetTaskCounts(...)
.ctor()
.ctor(...)
.ctor(...)
.ctor(...)
get_CustomBehaviors()
get_CommonEnvironmentSettings()
set_CommonEnvironmentSettings(...)
get_Constraints()
set_Constraints(...)
get_CreationTime()
get_DisplayName()
set_DisplayName(...)
get_ETag()
get_ExecutionInformation()
get_Id()
set_Id(...)
get_JobManagerTask()
set_JobManagerTask(...)
get_JobPreparationTask()
set_JobPreparationTask(...)
get_JobReleaseTask()
set_JobReleaseTask(...)
get_LastModified()
get_Metadata()
set_Metadata(...)
get_NetworkConfiguration()
set_NetworkConfiguration(...)
get_OnAllTasksComplete()
set_OnAllTasksComplete(...)
get_OnTaskFailure()
set_OnTaskFailure(...)
get_PoolInformation()
set_PoolInformation(...)
get_PreviousState()
get_PreviousStateTransitionTime()
get_Priority()
set_Priority(...)
get_State()
get_StateTransitionTime()
get_Statistics()
get_Url()
get_UsesTaskDependencies()
set_UsesTaskDependencies(...)
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobAddParameter>.GetTransportObject()