< Summary

Class:Microsoft.Azure.Batch.JobSpecification
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\JobSpecification.cs
C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\JobSpecification.cs
Covered lines:126
Uncovered lines:3
Coverable lines:129
Total lines:353
Line coverage:97.6% (126 of 129)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
get_CommonEnvironmentSettings()-100%100%
set_CommonEnvironmentSettings(...)-100%100%
get_Constraints()-100%100%
set_Constraints(...)-100%100%
get_DisplayName()-100%100%
set_DisplayName(...)-100%100%
get_JobManagerTask()-100%100%
set_JobManagerTask(...)-100%100%
get_JobPreparationTask()-100%100%
set_JobPreparationTask(...)-100%100%
get_JobReleaseTask()-100%100%
set_JobReleaseTask(...)-100%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%
get_OnTaskFailure()-100%100%
set_OnTaskFailure(...)-100%100%
get_PoolInformation()-100%100%
set_PoolInformation(...)-100%100%
get_Priority()-100%100%
set_Priority(...)-100%100%
get_UsesTaskDependencies()-100%100%
set_UsesTaskDependencies(...)-100%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-100%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-100%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobSpecification>.GetTransportObject()-100%100%
.ctor()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\JobSpecification.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
 14614{
 15    using Models = Microsoft.Azure.Batch.Protocol.Models;
 14616    using System;
 17    using System.Collections.Generic;
 18    using System.Linq;
 19
 20    /// <summary>
 21    /// The <see cref="CloudJobSchedule.JobSpecification"/> of a <see cref="CloudJobSchedule"/>.
 22    /// </summary>
 23    public partial class JobSpecification : ITransportObjectProvider<Models.JobSpecification>, IPropertyMetadata
 24    {
 25        private class PropertyContainer : PropertyCollection
 26        {
 27            public readonly PropertyAccessor<IList<EnvironmentSetting>> CommonEnvironmentSettingsProperty;
 28            public readonly PropertyAccessor<JobConstraints> ConstraintsProperty;
 29            public readonly PropertyAccessor<string> DisplayNameProperty;
 30            public readonly PropertyAccessor<JobManagerTask> JobManagerTaskProperty;
 31            public readonly PropertyAccessor<JobPreparationTask> JobPreparationTaskProperty;
 32            public readonly PropertyAccessor<JobReleaseTask> JobReleaseTaskProperty;
 33            public readonly PropertyAccessor<IList<MetadataItem>> MetadataProperty;
 34            public readonly PropertyAccessor<JobNetworkConfiguration> NetworkConfigurationProperty;
 35            public readonly PropertyAccessor<Common.OnAllTasksComplete?> OnAllTasksCompleteProperty;
 36            public readonly PropertyAccessor<Common.OnTaskFailure?> OnTaskFailureProperty;
 37            public readonly PropertyAccessor<PoolInformation> PoolInformationProperty;
 38            public readonly PropertyAccessor<int?> PriorityProperty;
 39            public readonly PropertyAccessor<bool?> UsesTaskDependenciesProperty;
 40
 14741            public PropertyContainer() : base(BindingState.Unbound)
 42            {
 14743                this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(C
 14744                this.ConstraintsProperty = this.CreatePropertyAccessor<JobConstraints>(nameof(Constraints), BindingAcces
 14745                this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read |
 14746                this.JobManagerTaskProperty = this.CreatePropertyAccessor<JobManagerTask>(nameof(JobManagerTask), Bindin
 14747                this.JobPreparationTaskProperty = this.CreatePropertyAccessor<JobPreparationTask>(nameof(JobPreparationT
 14748                this.JobReleaseTaskProperty = this.CreatePropertyAccessor<JobReleaseTask>(nameof(JobReleaseTask), Bindin
 14749                this.MetadataProperty = this.CreatePropertyAccessor<IList<MetadataItem>>(nameof(Metadata), BindingAccess
 14750                this.NetworkConfigurationProperty = this.CreatePropertyAccessor<JobNetworkConfiguration>(nameof(NetworkC
 14751                this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor<Common.OnAllTasksComplete?>(nameof(OnAllTa
 14752                this.OnTaskFailureProperty = this.CreatePropertyAccessor<Common.OnTaskFailure?>(nameof(OnTaskFailure), B
 14753                this.PoolInformationProperty = this.CreatePropertyAccessor<PoolInformation>(nameof(PoolInformation), Bin
 14754                this.PriorityProperty = this.CreatePropertyAccessor<int?>(nameof(Priority), BindingAccess.Read | Binding
 14755                this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor<bool?>(nameof(UsesTaskDependencies), Bin
 14756            }
 57
 48658            public PropertyContainer(Models.JobSpecification protocolObject) : base(BindingState.Bound)
 59            {
 48660                this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor(
 48661                    EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.CommonEnvironmentSettings),
 48662                    nameof(CommonEnvironmentSettings),
 48663                    BindingAccess.Read | BindingAccess.Write);
 48664                this.ConstraintsProperty = this.CreatePropertyAccessor(
 73565                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new JobConstraints(o)),
 48666                    nameof(Constraints),
 48667                    BindingAccess.Read | BindingAccess.Write);
 48668                this.DisplayNameProperty = this.CreatePropertyAccessor(
 48669                    protocolObject.DisplayName,
 48670                    nameof(DisplayName),
 48671                    BindingAccess.Read | BindingAccess.Write);
 48672                this.JobManagerTaskProperty = this.CreatePropertyAccessor(
 70073                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobManagerTask, o => new JobManagerTask(o
 48674                    nameof(JobManagerTask),
 48675                    BindingAccess.Read | BindingAccess.Write);
 48676                this.JobPreparationTaskProperty = this.CreatePropertyAccessor(
 72977                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobPreparationTask, o => new JobPreparati
 48678                    nameof(JobPreparationTask),
 48679                    BindingAccess.Read | BindingAccess.Write);
 48680                this.JobReleaseTaskProperty = this.CreatePropertyAccessor(
 73481                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobReleaseTask, o => new JobReleaseTask(o
 48682                    nameof(JobReleaseTask),
 48683                    BindingAccess.Read | BindingAccess.Write);
 48684                this.MetadataProperty = this.CreatePropertyAccessor(
 48685                    MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata),
 48686                    nameof(Metadata),
 48687                    BindingAccess.Read | BindingAccess.Write);
 48688                this.NetworkConfigurationProperty = this.CreatePropertyAccessor(
 72989                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NetworkConfiguration, o => new JobNetwork
 48690                    nameof(NetworkConfiguration),
 48691                    BindingAccess.Read);
 48692                this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor(
 48693                    UtilitiesInternal.MapNullableEnum<Models.OnAllTasksComplete, Common.OnAllTasksComplete>(protocolObje
 48694                    nameof(OnAllTasksComplete),
 48695                    BindingAccess.Read | BindingAccess.Write);
 48696                this.OnTaskFailureProperty = this.CreatePropertyAccessor(
 48697                    UtilitiesInternal.MapNullableEnum<Models.OnTaskFailure, Common.OnTaskFailure>(protocolObject.OnTaskF
 48698                    nameof(OnTaskFailure),
 48699                    BindingAccess.Read | BindingAccess.Write);
 486100                this.PoolInformationProperty = this.CreatePropertyAccessor(
 972101                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PoolInfo, o => new PoolInformation(o)),
 486102                    nameof(PoolInformation),
 486103                    BindingAccess.Read | BindingAccess.Write);
 486104                this.PriorityProperty = this.CreatePropertyAccessor(
 486105                    protocolObject.Priority,
 486106                    nameof(Priority),
 486107                    BindingAccess.Read | BindingAccess.Write);
 486108                this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor(
 486109                    protocolObject.UsesTaskDependencies,
 486110                    nameof(UsesTaskDependencies),
 486111                    BindingAccess.Read | BindingAccess.Write);
 486112            }
 113        }
 114
 115        private readonly PropertyContainer propertyContainer;
 116
 117        #region Constructors
 118
 119        /// <summary>
 120        /// Initializes a new instance of the <see cref="JobSpecification"/> class.
 121        /// </summary>
 122        /// <param name='poolInformation'>The pool on which the Batch service runs the tasks of jobs created via this <s
 147123        public JobSpecification(
 147124            PoolInformation poolInformation)
 125        {
 147126            this.propertyContainer = new PropertyContainer();
 147127            this.PoolInformation = poolInformation;
 147128        }
 129
 486130        internal JobSpecification(Models.JobSpecification protocolObject)
 131        {
 486132            this.propertyContainer = new PropertyContainer(protocolObject);
 486133        }
 134
 135        #endregion Constructors
 136
 137        #region JobSpecification
 138
 139        /// <summary>
 140        /// Gets or sets a list of common environment variable settings.
 141        /// </summary>
 142        /// <remarks>
 143        /// These environment variables are set for all tasks in jobs created under this <see cref="CloudJobSchedule"/> 
 144        /// the Job Manager, Job Preparation and Job Release tasks).
 145        /// </remarks>
 146        public IList<EnvironmentSetting> CommonEnvironmentSettings
 147        {
 768148            get { return this.propertyContainer.CommonEnvironmentSettingsProperty.Value; }
 149            set
 150            {
 68151                this.propertyContainer.CommonEnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<E
 67152            }
 153        }
 154
 155        /// <summary>
 156        /// Gets or sets the execution constraints for jobs created via this <see cref="JobSpecification"/>.
 157        /// </summary>
 158        public JobConstraints Constraints
 159        {
 768160            get { return this.propertyContainer.ConstraintsProperty.Value; }
 141161            set { this.propertyContainer.ConstraintsProperty.Value = value; }
 162        }
 163
 164        /// <summary>
 165        /// Gets or sets a display name for all jobs created via this <see cref="JobSpecification"/>.
 166        /// </summary>
 167        public string DisplayName
 168        {
 769169            get { return this.propertyContainer.DisplayNameProperty.Value; }
 113170            set { this.propertyContainer.DisplayNameProperty.Value = value; }
 171        }
 172
 173        /// <summary>
 174        /// Gets or sets details of a Job Manager task to be launched when a job is created via this <see cref="JobSpeci
 175        /// </summary>
 176        public JobManagerTask JobManagerTask
 177        {
 768178            get { return this.propertyContainer.JobManagerTaskProperty.Value; }
 125179            set { this.propertyContainer.JobManagerTaskProperty.Value = value; }
 180        }
 181
 182        /// <summary>
 183        /// Gets or sets the Job Preparation task for jobs created via this <see cref="JobSpecification"/>.
 184        /// </summary>
 185        /// <remarks>
 186        /// The Batch service will run the Job Preparation task on a compute node before starting any tasks of that job 
 187        /// that compute node.
 188        /// </remarks>
 189        public JobPreparationTask JobPreparationTask
 190        {
 768191            get { return this.propertyContainer.JobPreparationTaskProperty.Value; }
 123192            set { this.propertyContainer.JobPreparationTaskProperty.Value = value; }
 193        }
 194
 195        /// <summary>
 196        /// Gets or sets the Job Release task for jobs created via this <see cref="JobSpecification"/>.
 197        /// </summary>
 198        /// <remarks>
 199        /// The Batch service runs the Job Release task when the job ends, on each compute node where any task of the jo
 200        /// has run.
 201        /// </remarks>
 202        public JobReleaseTask JobReleaseTask
 203        {
 768204            get { return this.propertyContainer.JobReleaseTaskProperty.Value; }
 137205            set { this.propertyContainer.JobReleaseTaskProperty.Value = value; }
 206        }
 207
 208        /// <summary>
 209        /// Gets or sets a list of name-value pairs associated with jobs created via this <see cref="JobSpecification"/>
 210        /// as metadata.
 211        /// </summary>
 212        public IList<MetadataItem> Metadata
 213        {
 768214            get { return this.propertyContainer.MetadataProperty.Value; }
 215            set
 216            {
 54217                this.propertyContainer.MetadataProperty.Value = ConcurrentChangeTrackedModifiableList<MetadataItem>.Tran
 53218            }
 219        }
 220
 221        /// <summary>
 222        /// Gets or sets the network configuration for the job.
 223        /// </summary>
 224        public JobNetworkConfiguration NetworkConfiguration
 225        {
 768226            get { return this.propertyContainer.NetworkConfigurationProperty.Value; }
 143227            set { this.propertyContainer.NetworkConfigurationProperty.Value = value; }
 228        }
 229
 230        /// <summary>
 231        /// Gets or sets the action the Batch service should take when all tasks in the job are in the <see cref="Common
 232        /// state.
 233        /// </summary>
 234        public Common.OnAllTasksComplete? OnAllTasksComplete
 235        {
 771236            get { return this.propertyContainer.OnAllTasksCompleteProperty.Value; }
 137237            set { this.propertyContainer.OnAllTasksCompleteProperty.Value = value; }
 238        }
 239
 240        /// <summary>
 241        /// Gets or sets the action the Batch service should take when any task in the job fails.
 242        /// </summary>
 243        /// <remarks>
 244        /// A task is considered to have failed if it completes with a non-zero exit code and has exhausted its retry co
 245        /// or if it had a scheduling error.
 246        /// </remarks>
 247        public Common.OnTaskFailure? OnTaskFailure
 248        {
 771249            get { return this.propertyContainer.OnTaskFailureProperty.Value; }
 137250            set { this.propertyContainer.OnTaskFailureProperty.Value = value; }
 251        }
 252
 253        /// <summary>
 254        /// Gets or sets the pool on which the Batch service runs the tasks of jobs created via this <see cref="JobSpeci
 255        /// </summary>
 256        public PoolInformation PoolInformation
 257        {
 771258            get { return this.propertyContainer.PoolInformationProperty.Value; }
 427259            set { this.propertyContainer.PoolInformationProperty.Value = value; }
 260        }
 261
 262        /// <summary>
 263        /// Gets or sets the priority of jobs created via this <see cref="JobSpecification"/>.
 264        /// </summary>
 265        /// <remarks>
 266        ///  Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highe
 267        /// priority.
 268        /// </remarks>
 269        public int? Priority
 270        {
 768271            get { return this.propertyContainer.PriorityProperty.Value; }
 135272            set { this.propertyContainer.PriorityProperty.Value = value; }
 273        }
 274
 275        /// <summary>
 276        /// Gets or sets whether tasks in jobs created under this <see cref="CloudJobSchedule"/> can define dependencies
 277        /// on each other.
 278        /// </summary>
 279        /// <remarks>
 280        /// The default value is false.
 281        /// </remarks>
 282        public bool? UsesTaskDependencies
 283        {
 769284            get { return this.propertyContainer.UsesTaskDependenciesProperty.Value; }
 144285            set { this.propertyContainer.UsesTaskDependenciesProperty.Value = value; }
 286        }
 287
 288        #endregion // JobSpecification
 289
 290        #region IPropertyMetadata
 291
 292        bool IModifiable.HasBeenModified
 293        {
 2294            get { return this.propertyContainer.HasBeenModified; }
 295        }
 296
 297        bool IReadOnly.IsReadOnly
 298        {
 0299            get { return this.propertyContainer.IsReadOnly; }
 12300            set { this.propertyContainer.IsReadOnly = value; }
 301        }
 302
 303        #endregion //IPropertyMetadata
 304
 305        #region Internal/private methods
 306        /// <summary>
 307        /// Return a protocol object of the requested type.
 308        /// </summary>
 309        /// <returns>The protocol object of the requested type.</returns>
 310        Models.JobSpecification ITransportObjectProvider<Models.JobSpecification>.GetTransportObject()
 311        {
 146312            Models.JobSpecification result = new Models.JobSpecification()
 146313            {
 146314                CommonEnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.CommonEnvironmentSettings
 216315                Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject(
 146316                DisplayName = this.DisplayName,
 208317                JobManagerTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobManagerTask, (o) => o.GetTransportO
 207318                JobPreparationTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobPreparationTask, (o) => o.GetTr
 214319                JobReleaseTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobReleaseTask, (o) => o.GetTransportO
 146320                Metadata = UtilitiesInternal.ConvertToProtocolCollection(this.Metadata),
 217321                NetworkConfiguration = UtilitiesInternal.CreateObjectWithNullCheck(this.NetworkConfiguration, (o) => o.G
 146322                OnAllTasksComplete = UtilitiesInternal.MapNullableEnum<Common.OnAllTasksComplete, Models.OnAllTasksCompl
 146323                OnTaskFailure = UtilitiesInternal.MapNullableEnum<Common.OnTaskFailure, Models.OnTaskFailure>(this.OnTas
 212324                PoolInfo = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolInformation, (o) => o.GetTransportObject
 146325                Priority = this.Priority,
 146326                UsesTaskDependencies = this.UsesTaskDependencies,
 146327            };
 328
 146329            return result;
 330        }
 331
 332
 333        #endregion // Internal/private methods
 334    }
 335}

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\JobSpecification.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
 5namespace Microsoft.Azure.Batch
 6{
 7    using System;
 8
 9    public partial class JobSpecification
 10    {
 11        /// <summary>
 12        /// Initializes a new instance of the <see cref="JobSpecification"/> class.
 13        /// </summary>
 014        public JobSpecification() : this(poolInformation: null)
 15        {
 016        }
 17    }
 18}