| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | | // |
| | 4 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 5 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 6 | | // regenerated. |
| | 7 | |
|
| | 8 | | // |
| | 9 | | // This file was autogenerated by a tool. |
| | 10 | | // Do not modify it. |
| | 11 | | // |
| | 12 | |
|
| | 13 | | namespace Microsoft.Azure.Batch |
| | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Settings which specify how to run a multi-instance task. Multi-instance tasks are commonly used to support MPI t |
| | 22 | | /// In the MPI case, if any of the subtasks fail (for example due to exiting with a non-zero exit code) the entire m |
| | 23 | | /// task fails. The multi-instance task is then terminated and retried, up to its retry limit. For more information |
| | 24 | | /// https://azure.microsoft.com/documentation/articles/batch-mpi/. |
| | 25 | | /// </summary> |
| | 26 | | public partial class MultiInstanceSettings : ITransportObjectProvider<Models.MultiInstanceSettings>, IPropertyMetada |
| | 27 | | { |
| | 28 | | private class PropertyContainer : PropertyCollection |
| | 29 | | { |
| | 30 | | public readonly PropertyAccessor<IList<ResourceFile>> CommonResourceFilesProperty; |
| | 31 | | public readonly PropertyAccessor<string> CoordinationCommandLineProperty; |
| | 32 | | public readonly PropertyAccessor<int?> NumberOfInstancesProperty; |
| | 33 | |
|
| 133 | 34 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 35 | | { |
| 133 | 36 | | this.CommonResourceFilesProperty = this.CreatePropertyAccessor<IList<ResourceFile>>(nameof(CommonResourc |
| 133 | 37 | | this.CoordinationCommandLineProperty = this.CreatePropertyAccessor<string>(nameof(CoordinationCommandLin |
| 133 | 38 | | this.NumberOfInstancesProperty = this.CreatePropertyAccessor<int?>(nameof(NumberOfInstances), BindingAcc |
| 133 | 39 | | } |
| | 40 | |
|
| 518 | 41 | | public PropertyContainer(Models.MultiInstanceSettings protocolObject) : base(BindingState.Bound) |
| | 42 | | { |
| 518 | 43 | | this.CommonResourceFilesProperty = this.CreatePropertyAccessor( |
| 518 | 44 | | ResourceFile.ConvertFromProtocolCollectionAndFreeze(protocolObject.CommonResourceFiles), |
| 518 | 45 | | nameof(CommonResourceFiles), |
| 518 | 46 | | BindingAccess.Read); |
| 518 | 47 | | this.CoordinationCommandLineProperty = this.CreatePropertyAccessor( |
| 518 | 48 | | protocolObject.CoordinationCommandLine, |
| 518 | 49 | | nameof(CoordinationCommandLine), |
| 518 | 50 | | BindingAccess.Read); |
| 518 | 51 | | this.NumberOfInstancesProperty = this.CreatePropertyAccessor( |
| 518 | 52 | | protocolObject.NumberOfInstances, |
| 518 | 53 | | nameof(NumberOfInstances), |
| 518 | 54 | | BindingAccess.Read); |
| 518 | 55 | | } |
| | 56 | | } |
| | 57 | |
|
| | 58 | | private readonly PropertyContainer propertyContainer; |
| | 59 | |
|
| | 60 | | #region Constructors |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// Initializes a new instance of the <see cref="MultiInstanceSettings"/> class. |
| | 64 | | /// </summary> |
| | 65 | | /// <param name='coordinationCommandLine'>The command to run on the compute node instances for coordinating amon |
| | 66 | | /// <param name='numberOfInstances'>The number of compute nodes required by the multi-instance task.</param> |
| 133 | 67 | | public MultiInstanceSettings( |
| 133 | 68 | | string coordinationCommandLine, |
| 133 | 69 | | int? numberOfInstances = default(int?)) |
| | 70 | | { |
| 133 | 71 | | this.propertyContainer = new PropertyContainer(); |
| 133 | 72 | | this.CoordinationCommandLine = coordinationCommandLine; |
| 133 | 73 | | this.NumberOfInstances = numberOfInstances; |
| 133 | 74 | | } |
| | 75 | |
|
| 518 | 76 | | internal MultiInstanceSettings(Models.MultiInstanceSettings protocolObject) |
| | 77 | | { |
| 518 | 78 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 518 | 79 | | } |
| | 80 | |
|
| | 81 | | #endregion Constructors |
| | 82 | |
|
| | 83 | | #region MultiInstanceSettings |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Gets or sets a list of files that the Batch service will download before running the coordination command li |
| | 87 | | /// </summary> |
| | 88 | | /// <remarks> |
| | 89 | | /// The difference between common resource files and task resource files is that common resource files are downl |
| | 90 | | /// for all subtasks including the primary, whereas task resource files are downloaded only for the primary. The |
| | 91 | | /// is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and t |
| | 92 | | /// response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be |
| | 93 | | /// in size. This can be achieved using .zip files, Application Packages, or Docker Containers. |
| | 94 | | /// </remarks> |
| | 95 | | public IList<ResourceFile> CommonResourceFiles |
| | 96 | | { |
| 783 | 97 | | get { return this.propertyContainer.CommonResourceFilesProperty.Value; } |
| | 98 | | set |
| | 99 | | { |
| 69 | 100 | | this.propertyContainer.CommonResourceFilesProperty.Value = ConcurrentChangeTrackedModifiableList<Resourc |
| 68 | 101 | | } |
| | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> |
| | 105 | | /// Gets or sets the command to run on the compute node instances for coordinating among the subtasks. |
| | 106 | | /// </summary> |
| | 107 | | public string CoordinationCommandLine |
| | 108 | | { |
| 783 | 109 | | get { return this.propertyContainer.CoordinationCommandLineProperty.Value; } |
| 389 | 110 | | set { this.propertyContainer.CoordinationCommandLineProperty.Value = value; } |
| | 111 | | } |
| | 112 | |
|
| | 113 | | /// <summary> |
| | 114 | | /// Gets or sets the number of compute nodes required by the multi-instance task. |
| | 115 | | /// </summary> |
| | 116 | | public int? NumberOfInstances |
| | 117 | | { |
| 783 | 118 | | get { return this.propertyContainer.NumberOfInstancesProperty.Value; } |
| 385 | 119 | | set { this.propertyContainer.NumberOfInstancesProperty.Value = value; } |
| | 120 | | } |
| | 121 | |
|
| | 122 | | #endregion // MultiInstanceSettings |
| | 123 | |
|
| | 124 | | #region IPropertyMetadata |
| | 125 | |
|
| | 126 | | bool IModifiable.HasBeenModified |
| | 127 | | { |
| 0 | 128 | | get { return this.propertyContainer.HasBeenModified; } |
| | 129 | | } |
| | 130 | |
|
| | 131 | | bool IReadOnly.IsReadOnly |
| | 132 | | { |
| 0 | 133 | | get { return this.propertyContainer.IsReadOnly; } |
| 1038 | 134 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 135 | | } |
| | 136 | |
|
| | 137 | | #endregion //IPropertyMetadata |
| | 138 | |
|
| | 139 | | #region Internal/private methods |
| | 140 | | /// <summary> |
| | 141 | | /// Return a protocol object of the requested type. |
| | 142 | | /// </summary> |
| | 143 | | /// <returns>The protocol object of the requested type.</returns> |
| | 144 | | Models.MultiInstanceSettings ITransportObjectProvider<Models.MultiInstanceSettings>.GetTransportObject() |
| | 145 | | { |
| 132 | 146 | | Models.MultiInstanceSettings result = new Models.MultiInstanceSettings() |
| 132 | 147 | | { |
| 132 | 148 | | CommonResourceFiles = UtilitiesInternal.ConvertToProtocolCollection(this.CommonResourceFiles), |
| 132 | 149 | | CoordinationCommandLine = this.CoordinationCommandLine, |
| 132 | 150 | | NumberOfInstances = this.NumberOfInstances, |
| 132 | 151 | | }; |
| | 152 | |
|
| 132 | 153 | | return result; |
| | 154 | | } |
| | 155 | |
|
| | 156 | |
|
| | 157 | | #endregion // Internal/private methods |
| | 158 | | } |
| | 159 | | } |