< Summary

Class:Microsoft.Azure.Batch.JobManagerTask
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\JobManagerTask.cs
C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\JobManagerTask.cs
Covered lines:137
Uncovered lines:4
Coverable lines:141
Total lines:396
Line coverage:97.1% (137 of 141)
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_AllowLowPriorityNode()-100%100%
set_AllowLowPriorityNode(...)-100%100%
get_ApplicationPackageReferences()-100%100%
set_ApplicationPackageReferences(...)-100%100%
get_AuthenticationTokenSettings()-100%100%
set_AuthenticationTokenSettings(...)-100%100%
get_CommandLine()-100%100%
set_CommandLine(...)-100%100%
get_Constraints()-100%100%
set_Constraints(...)-100%100%
get_ContainerSettings()-100%100%
set_ContainerSettings(...)-100%100%
get_DisplayName()-100%100%
set_DisplayName(...)-100%100%
get_EnvironmentSettings()-100%100%
set_EnvironmentSettings(...)-100%100%
get_Id()-100%100%
set_Id(...)-100%100%
get_KillJobOnCompletion()-100%100%
set_KillJobOnCompletion(...)-100%100%
get_OutputFiles()-100%100%
set_OutputFiles(...)-100%100%
get_ResourceFiles()-100%100%
set_ResourceFiles(...)-100%100%
get_RunExclusive()-100%100%
set_RunExclusive(...)-100%100%
get_UserIdentity()-100%100%
set_UserIdentity(...)-100%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%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobManagerTask>.GetTransportObject()-100%100%
.ctor()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\JobManagerTask.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
 21213namespace Microsoft.Azure.Batch
 14{
 21215    using Models = Microsoft.Azure.Batch.Protocol.Models;
 16    using System;
 17    using System.Collections.Generic;
 18    using System.Linq;
 19
 20    /// <summary>
 21    /// Represents an Azure Batch JobManager task.
 22    /// </summary>
 23    /// <remarks>
 24    /// Batch will retry tasks when a recovery operation is triggered on a compute node. Examples of recovery operations
 25    /// include (but are not limited to) when an unhealthy compute node is rebooted or a compute node disappeared due to
 26    /// host failure. Retries due to recovery operations are independent of and are not counted against the <see cref="T
 27    /// />. Even if the <see cref="TaskConstraints.MaxTaskRetryCount" /> is 0, an internal retry due to a recovery opera
 28    /// may occur. Because of this, all tasks should be idempotent. This means tasks need to tolerate being interrupted 
 29    /// restarted without causing any corruption or duplicate data. The best practice for long running tasks is to use s
 30    /// form of checkpointing.
 31    /// </remarks>
 32    public partial class JobManagerTask : ITransportObjectProvider<Models.JobManagerTask>, IPropertyMetadata
 33    {
 34        private class PropertyContainer : PropertyCollection
 35        {
 36            public readonly PropertyAccessor<bool?> AllowLowPriorityNodeProperty;
 37            public readonly PropertyAccessor<IList<ApplicationPackageReference>> ApplicationPackageReferencesProperty;
 38            public readonly PropertyAccessor<AuthenticationTokenSettings> AuthenticationTokenSettingsProperty;
 39            public readonly PropertyAccessor<string> CommandLineProperty;
 40            public readonly PropertyAccessor<TaskConstraints> ConstraintsProperty;
 41            public readonly PropertyAccessor<TaskContainerSettings> ContainerSettingsProperty;
 42            public readonly PropertyAccessor<string> DisplayNameProperty;
 43            public readonly PropertyAccessor<IList<EnvironmentSetting>> EnvironmentSettingsProperty;
 44            public readonly PropertyAccessor<string> IdProperty;
 45            public readonly PropertyAccessor<bool?> KillJobOnCompletionProperty;
 46            public readonly PropertyAccessor<IList<OutputFile>> OutputFilesProperty;
 47            public readonly PropertyAccessor<IList<ResourceFile>> ResourceFilesProperty;
 48            public readonly PropertyAccessor<bool?> RunExclusiveProperty;
 49            public readonly PropertyAccessor<UserIdentity> UserIdentityProperty;
 50
 21251            public PropertyContainer() : base(BindingState.Unbound)
 52            {
 21253                this.AllowLowPriorityNodeProperty = this.CreatePropertyAccessor<bool?>(nameof(AllowLowPriorityNode), Bin
 21254                this.ApplicationPackageReferencesProperty = this.CreatePropertyAccessor<IList<ApplicationPackageReferenc
 21255                this.AuthenticationTokenSettingsProperty = this.CreatePropertyAccessor<AuthenticationTokenSettings>(name
 21256                this.CommandLineProperty = this.CreatePropertyAccessor<string>(nameof(CommandLine), BindingAccess.Read |
 21257                this.ConstraintsProperty = this.CreatePropertyAccessor<TaskConstraints>(nameof(Constraints), BindingAcce
 21258                this.ContainerSettingsProperty = this.CreatePropertyAccessor<TaskContainerSettings>(nameof(ContainerSett
 21259                this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read |
 21260                this.EnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(Environ
 21261                this.IdProperty = this.CreatePropertyAccessor<string>(nameof(Id), BindingAccess.Read | BindingAccess.Wri
 21262                this.KillJobOnCompletionProperty = this.CreatePropertyAccessor<bool?>(nameof(KillJobOnCompletion), Bindi
 21263                this.OutputFilesProperty = this.CreatePropertyAccessor<IList<OutputFile>>(nameof(OutputFiles), BindingAc
 21264                this.ResourceFilesProperty = this.CreatePropertyAccessor<IList<ResourceFile>>(nameof(ResourceFiles), Bin
 21265                this.RunExclusiveProperty = this.CreatePropertyAccessor<bool?>(nameof(RunExclusive), BindingAccess.Read 
 21266                this.UserIdentityProperty = this.CreatePropertyAccessor<UserIdentity>(nameof(UserIdentity), BindingAcces
 21267            }
 68
 71469            public PropertyContainer(Models.JobManagerTask protocolObject) : base(BindingState.Bound)
 70            {
 71471                this.AllowLowPriorityNodeProperty = this.CreatePropertyAccessor(
 71472                    protocolObject.AllowLowPriorityNode,
 71473                    nameof(AllowLowPriorityNode),
 71474                    BindingAccess.Read | BindingAccess.Write);
 71475                this.ApplicationPackageReferencesProperty = this.CreatePropertyAccessor(
 71476                    ApplicationPackageReference.ConvertFromProtocolCollection(protocolObject.ApplicationPackageReference
 71477                    nameof(ApplicationPackageReferences),
 71478                    BindingAccess.Read | BindingAccess.Write);
 71479                this.AuthenticationTokenSettingsProperty = this.CreatePropertyAccessor(
 107280                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.AuthenticationTokenSettings, o => new Aut
 71481                    nameof(AuthenticationTokenSettings),
 71482                    BindingAccess.Read | BindingAccess.Write);
 71483                this.CommandLineProperty = this.CreatePropertyAccessor(
 71484                    protocolObject.CommandLine,
 71485                    nameof(CommandLine),
 71486                    BindingAccess.Read | BindingAccess.Write);
 71487                this.ConstraintsProperty = this.CreatePropertyAccessor(
 107988                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new TaskConstraints(o))
 71489                    nameof(Constraints),
 71490                    BindingAccess.Read | BindingAccess.Write);
 71491                this.ContainerSettingsProperty = this.CreatePropertyAccessor(
 109492                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ContainerSettings, o => new TaskContainer
 71493                    nameof(ContainerSettings),
 71494                    BindingAccess.Read);
 71495                this.DisplayNameProperty = this.CreatePropertyAccessor(
 71496                    protocolObject.DisplayName,
 71497                    nameof(DisplayName),
 71498                    BindingAccess.Read | BindingAccess.Write);
 71499                this.EnvironmentSettingsProperty = this.CreatePropertyAccessor(
 714100                    EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.EnvironmentSettings),
 714101                    nameof(EnvironmentSettings),
 714102                    BindingAccess.Read | BindingAccess.Write);
 714103                this.IdProperty = this.CreatePropertyAccessor(
 714104                    protocolObject.Id,
 714105                    nameof(Id),
 714106                    BindingAccess.Read | BindingAccess.Write);
 714107                this.KillJobOnCompletionProperty = this.CreatePropertyAccessor(
 714108                    protocolObject.KillJobOnCompletion,
 714109                    nameof(KillJobOnCompletion),
 714110                    BindingAccess.Read | BindingAccess.Write);
 714111                this.OutputFilesProperty = this.CreatePropertyAccessor(
 714112                    OutputFile.ConvertFromProtocolCollection(protocolObject.OutputFiles),
 714113                    nameof(OutputFiles),
 714114                    BindingAccess.Read | BindingAccess.Write);
 714115                this.ResourceFilesProperty = this.CreatePropertyAccessor(
 714116                    ResourceFile.ConvertFromProtocolCollection(protocolObject.ResourceFiles),
 714117                    nameof(ResourceFiles),
 714118                    BindingAccess.Read | BindingAccess.Write);
 714119                this.RunExclusiveProperty = this.CreatePropertyAccessor(
 714120                    protocolObject.RunExclusive,
 714121                    nameof(RunExclusive),
 714122                    BindingAccess.Read | BindingAccess.Write);
 714123                this.UserIdentityProperty = this.CreatePropertyAccessor(
 1060124                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.UserIdentity, o => new UserIdentity(o)),
 714125                    nameof(UserIdentity),
 714126                    BindingAccess.Read | BindingAccess.Write);
 714127            }
 128        }
 129
 130        private readonly PropertyContainer propertyContainer;
 131
 132        #region Constructors
 133
 134        /// <summary>
 135        /// Initializes a new instance of the <see cref="JobManagerTask"/> class.
 136        /// </summary>
 137        /// <param name='id'>The id of the task.</param>
 138        /// <param name='commandLine'>The command line of the task.</param>
 212139        public JobManagerTask(
 212140            string id,
 212141            string commandLine)
 142        {
 212143            this.propertyContainer = new PropertyContainer();
 212144            this.Id = id;
 212145            this.CommandLine = commandLine;
 212146        }
 147
 714148        internal JobManagerTask(Models.JobManagerTask protocolObject)
 149        {
 714150            this.propertyContainer = new PropertyContainer(protocolObject);
 714151        }
 152
 153        #endregion Constructors
 154
 155        #region JobManagerTask
 156
 157        /// <summary>
 158        /// Gets or sets whether the Job Manager task may run on a low-priority compute node. If omitted, the default is
 159        /// true.
 160        /// </summary>
 161        public bool? AllowLowPriorityNode
 162        {
 1132163            get { return this.propertyContainer.AllowLowPriorityNodeProperty.Value; }
 215164            set { this.propertyContainer.AllowLowPriorityNodeProperty.Value = value; }
 165        }
 166
 167        /// <summary>
 168        /// Gets or sets a list of application packages that the Batch service will deploy to the compute node before ru
 169        /// the command line.
 170        /// </summary>
 171        public IList<ApplicationPackageReference> ApplicationPackageReferences
 172        {
 1136173            get { return this.propertyContainer.ApplicationPackageReferencesProperty.Value; }
 174            set
 175            {
 107176                this.propertyContainer.ApplicationPackageReferencesProperty.Value = ConcurrentChangeTrackedModifiableLis
 105177            }
 178        }
 179
 180        /// <summary>
 181        /// Gets or sets the settings for an authentication token that the task can use to perform Batch service operati
 182        /// </summary>
 183        /// <remarks>
 184        /// If this property is set, the Batch service provides the task with an authentication token which can be used 
 185        /// authenticate Batch service operations without requiring an account access key. The token is provided via the
 186        /// AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the tok
 187        /// depend on the settings. For example, a task can request job permissions in order to add other tasks to the j
 188        /// or check the status of the job or of other tasks.
 189        /// </remarks>
 190        public AuthenticationTokenSettings AuthenticationTokenSettings
 191        {
 1132192            get { return this.propertyContainer.AuthenticationTokenSettingsProperty.Value; }
 208193            set { this.propertyContainer.AuthenticationTokenSettingsProperty.Value = value; }
 194        }
 195
 196        /// <summary>
 197        /// Gets or sets the command line of the task.
 198        /// </summary>
 199        /// <remarks>
 200        /// The command line does not run under a shell, and therefore cannot take advantage of shell features such as e
 201        /// variable expansion. If you want to take advantage of such features, you should invoke the shell in the comma
 202        /// line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command lin
 203        /// refers to file paths, it should use a relative path (relative to the task working directory), or use the Bat
 204        /// provided environment variables (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-
 205        /// </remarks>
 206        public string CommandLine
 207        {
 1132208            get { return this.propertyContainer.CommandLineProperty.Value; }
 637209            set { this.propertyContainer.CommandLineProperty.Value = value; }
 210        }
 211
 212        /// <summary>
 213        /// Gets or sets the execution constraints for this JobManager task.
 214        /// </summary>
 215        public TaskConstraints Constraints
 216        {
 1132217            get { return this.propertyContainer.ConstraintsProperty.Value; }
 191218            set { this.propertyContainer.ConstraintsProperty.Value = value; }
 219        }
 220
 221        /// <summary>
 222        /// Gets or sets the settings for the container under which the task runs.
 223        /// </summary>
 224        /// <remarks>
 225        /// If the pool that will run this task has <see cref="VirtualMachineConfiguration.ContainerConfiguration"/> set
 226        /// this must be set as well. If the pool that will run this task doesn't have <see cref="VirtualMachineConfigur
 227        /// set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_
 228        /// (the root of Azure Batch directories on the node) are mapped into the container, all task environment variab
 229        /// are mapped into the container, and the task command line is executed in the container. Files produced in the
 230        /// container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file
 231        /// APIs will not be able to access them.
 232        /// </remarks>
 233        public TaskContainerSettings ContainerSettings
 234        {
 1132235            get { return this.propertyContainer.ContainerSettingsProperty.Value; }
 199236            set { this.propertyContainer.ContainerSettingsProperty.Value = value; }
 237        }
 238
 239        /// <summary>
 240        /// Gets or sets the display name of the JobManager task.
 241        /// </summary>
 242        public string DisplayName
 243        {
 1132244            get { return this.propertyContainer.DisplayNameProperty.Value; }
 201245            set { this.propertyContainer.DisplayNameProperty.Value = value; }
 246        }
 247
 248        /// <summary>
 249        /// Gets or sets a set of environment settings for the JobManager task.
 250        /// </summary>
 251        public IList<EnvironmentSetting> EnvironmentSettings
 252        {
 1132253            get { return this.propertyContainer.EnvironmentSettingsProperty.Value; }
 254            set
 255            {
 106256                this.propertyContainer.EnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<Environ
 105257            }
 258        }
 259
 260        /// <summary>
 261        /// Gets or sets the id of the task.
 262        /// </summary>
 263        public string Id
 264        {
 1132265            get { return this.propertyContainer.IdProperty.Value; }
 623266            set { this.propertyContainer.IdProperty.Value = value; }
 267        }
 268
 269        /// <summary>
 270        /// Gets or sets a value that indicates whether to terminate all tasks in the job and complete the job when the 
 271        /// manager task completes.
 272        /// </summary>
 273        public bool? KillJobOnCompletion
 274        {
 1132275            get { return this.propertyContainer.KillJobOnCompletionProperty.Value; }
 201276            set { this.propertyContainer.KillJobOnCompletionProperty.Value = value; }
 277        }
 278
 279        /// <summary>
 280        /// Gets or sets a list of files that the Batch service will upload from the compute node after running the comm
 281        /// line.
 282        /// </summary>
 283        public IList<OutputFile> OutputFiles
 284        {
 1132285            get { return this.propertyContainer.OutputFilesProperty.Value; }
 286            set
 287            {
 94288                this.propertyContainer.OutputFilesProperty.Value = ConcurrentChangeTrackedModifiableList<OutputFile>.Tra
 93289            }
 290        }
 291
 292        /// <summary>
 293        /// Gets or sets a list of files that the Batch service will download to the compute node before running the com
 294        /// line.
 295        /// </summary>
 296        /// <remarks>
 297        /// There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail
 298        /// and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files 
 299        /// be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.
 300        /// </remarks>
 301        public IList<ResourceFile> ResourceFiles
 302        {
 1132303            get { return this.propertyContainer.ResourceFilesProperty.Value; }
 304            set
 305            {
 103306                this.propertyContainer.ResourceFilesProperty.Value = ConcurrentChangeTrackedModifiableList<ResourceFile>
 102307            }
 308        }
 309
 310        /// <summary>
 311        /// Gets or sets whether the Job Manager task requires exclusive use of the compute node where it runs.
 312        /// </summary>
 313        public bool? RunExclusive
 314        {
 1132315            get { return this.propertyContainer.RunExclusiveProperty.Value; }
 203316            set { this.propertyContainer.RunExclusiveProperty.Value = value; }
 317        }
 318
 319        /// <summary>
 320        /// Gets or sets the user identity under which the task runs.
 321        /// </summary>
 322        /// <remarks>
 323        /// If omitted, the task runs as a non-administrative user unique to the task.
 324        /// </remarks>
 325        public UserIdentity UserIdentity
 326        {
 1132327            get { return this.propertyContainer.UserIdentityProperty.Value; }
 203328            set { this.propertyContainer.UserIdentityProperty.Value = value; }
 329        }
 330
 331        #endregion // JobManagerTask
 332
 333        #region IPropertyMetadata
 334
 335        bool IModifiable.HasBeenModified
 336        {
 0337            get { return this.propertyContainer.HasBeenModified; }
 338        }
 339
 340        bool IReadOnly.IsReadOnly
 341        {
 0342            get { return this.propertyContainer.IsReadOnly; }
 1004343            set { this.propertyContainer.IsReadOnly = value; }
 344        }
 345
 346        #endregion //IPropertyMetadata
 347
 348        #region Internal/private methods
 349        /// <summary>
 350        /// Return a protocol object of the requested type.
 351        /// </summary>
 352        /// <returns>The protocol object of the requested type.</returns>
 353        Models.JobManagerTask ITransportObjectProvider<Models.JobManagerTask>.GetTransportObject()
 354        {
 210355            Models.JobManagerTask result = new Models.JobManagerTask()
 210356            {
 210357                AllowLowPriorityNode = this.AllowLowPriorityNode,
 210358                ApplicationPackageReferences = UtilitiesInternal.ConvertToProtocolCollection(this.ApplicationPackageRefe
 313359                AuthenticationTokenSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.AuthenticationTokenSettin
 210360                CommandLine = this.CommandLine,
 305361                Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject(
 309362                ContainerSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.ContainerSettings, (o) => o.GetTran
 210363                DisplayName = this.DisplayName,
 210364                EnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.EnvironmentSettings),
 210365                Id = this.Id,
 210366                KillJobOnCompletion = this.KillJobOnCompletion,
 210367                OutputFiles = UtilitiesInternal.ConvertToProtocolCollection(this.OutputFiles),
 210368                ResourceFiles = UtilitiesInternal.ConvertToProtocolCollection(this.ResourceFiles),
 210369                RunExclusive = this.RunExclusive,
 311370                UserIdentity = UtilitiesInternal.CreateObjectWithNullCheck(this.UserIdentity, (o) => o.GetTransportObjec
 210371            };
 372
 210373            return result;
 374        }
 375
 376
 377        #endregion // Internal/private methods
 378    }
 379}

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\JobManagerTask.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
 8    public partial class JobManagerTask
 9    {
 10        /// <summary>
 11        /// Initializes a new instance of the <see cref="JobManagerTask"/> class.
 12        /// </summary>
 013        public JobManagerTask() : this(id: null, commandLine: null)
 14        {
 015        }
 16    }
 17}