| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.Batch.Protocol.Models |
| | 12 | | { |
| | 13 | | using Newtonsoft.Json; |
| | 14 | | using System.Collections; |
| | 15 | | using System.Collections.Generic; |
| | 16 | | using System.Linq; |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// A Job Preparation Task to run before any Tasks of the Job on any given |
| | 20 | | /// Compute Node. |
| | 21 | | /// </summary> |
| | 22 | | /// <remarks> |
| | 23 | | /// You can use Job Preparation to prepare a Node to run Tasks for the Job. |
| | 24 | | /// Activities commonly performed in Job Preparation include: Downloading |
| | 25 | | /// common resource files used by all the Tasks in the Job. The Job |
| | 26 | | /// Preparation Task can download these common resource files to the shared |
| | 27 | | /// location on the Node. (AZ_BATCH_NODE_ROOT_DIR\shared), or starting a |
| | 28 | | /// local service on the Node so that all Tasks of that Job can communicate |
| | 29 | | /// with it. If the Job Preparation Task fails (that is, exhausts its retry |
| | 30 | | /// count before exiting with exit code 0), Batch will not run Tasks of |
| | 31 | | /// this Job on the Node. The Compute Node remains ineligible to run Tasks |
| | 32 | | /// of this Job until it is reimaged. The Compute Node remains active and |
| | 33 | | /// can be used for other Jobs. The Job Preparation Task can run multiple |
| | 34 | | /// times on the same Node. Therefore, you should write the Job Preparation |
| | 35 | | /// Task to handle re-execution. If the Node is rebooted, the Job |
| | 36 | | /// Preparation Task is run again on the Compute Node before scheduling any |
| | 37 | | /// other Task of the Job, if rerunOnNodeRebootAfterSuccess is true or if |
| | 38 | | /// the Job Preparation Task did not previously complete. If the Node is |
| | 39 | | /// reimaged, the Job Preparation Task is run again before scheduling any |
| | 40 | | /// Task of the Job. Batch will retry Tasks when a recovery operation is |
| | 41 | | /// triggered on a Node. Examples of recovery operations include (but are |
| | 42 | | /// not limited to) when an unhealthy Node is rebooted or a Compute Node |
| | 43 | | /// disappeared due to host failure. Retries due to recovery operations are |
| | 44 | | /// independent of and are not counted against the maxTaskRetryCount. Even |
| | 45 | | /// if the maxTaskRetryCount is 0, an internal retry due to a recovery |
| | 46 | | /// operation may occur. Because of this, all Tasks should be idempotent. |
| | 47 | | /// This means Tasks need to tolerate being interrupted and restarted |
| | 48 | | /// without causing any corruption or duplicate data. The best practice for |
| | 49 | | /// long running Tasks is to use some form of checkpointing. |
| | 50 | | /// </remarks> |
| | 51 | | public partial class JobPreparationTask |
| | 52 | | { |
| | 53 | | /// <summary> |
| | 54 | | /// Initializes a new instance of the JobPreparationTask class. |
| | 55 | | /// </summary> |
| 975 | 56 | | public JobPreparationTask() |
| | 57 | | { |
| | 58 | | CustomInit(); |
| 975 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Initializes a new instance of the JobPreparationTask class. |
| | 63 | | /// </summary> |
| | 64 | | /// <param name="commandLine">The command line of the Job Preparation |
| | 65 | | /// Task.</param> |
| | 66 | | /// <param name="id">A string that uniquely identifies the Job |
| | 67 | | /// Preparation Task within the Job.</param> |
| | 68 | | /// <param name="containerSettings">The settings for the container |
| | 69 | | /// under which the Job Preparation Task runs.</param> |
| | 70 | | /// <param name="resourceFiles">A list of files that the Batch service |
| | 71 | | /// will download to the Compute Node before running the command |
| | 72 | | /// line.</param> |
| | 73 | | /// <param name="environmentSettings">A list of environment variable |
| | 74 | | /// settings for the Job Preparation Task.</param> |
| | 75 | | /// <param name="constraints">Constraints that apply to the Job |
| | 76 | | /// Preparation Task.</param> |
| | 77 | | /// <param name="waitForSuccess">Whether the Batch service should wait |
| | 78 | | /// for the Job Preparation Task to complete successfully before |
| | 79 | | /// scheduling any other Tasks of the Job on the Compute Node. A Job |
| | 80 | | /// Preparation Task has completed successfully if it exits with exit |
| | 81 | | /// code 0.</param> |
| | 82 | | /// <param name="userIdentity">The user identity under which the Job |
| | 83 | | /// Preparation Task runs.</param> |
| | 84 | | /// <param name="rerunOnNodeRebootAfterSuccess">Whether the Batch |
| | 85 | | /// service should rerun the Job Preparation Task after a Compute Node |
| | 86 | | /// reboots.</param> |
| 1 | 87 | | public JobPreparationTask(string commandLine, string id = default(string), TaskContainerSettings containerSettin |
| | 88 | | { |
| 1 | 89 | | Id = id; |
| 1 | 90 | | CommandLine = commandLine; |
| 1 | 91 | | ContainerSettings = containerSettings; |
| 1 | 92 | | ResourceFiles = resourceFiles; |
| 1 | 93 | | EnvironmentSettings = environmentSettings; |
| 1 | 94 | | Constraints = constraints; |
| 1 | 95 | | WaitForSuccess = waitForSuccess; |
| 1 | 96 | | UserIdentity = userIdentity; |
| 1 | 97 | | RerunOnNodeRebootAfterSuccess = rerunOnNodeRebootAfterSuccess; |
| | 98 | | CustomInit(); |
| 1 | 99 | | } |
| | 100 | |
|
| | 101 | | /// <summary> |
| | 102 | | /// An initialization method that performs custom operations like setting defaults |
| | 103 | | /// </summary> |
| | 104 | | partial void CustomInit(); |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Gets or sets a string that uniquely identifies the Job Preparation |
| | 108 | | /// Task within the Job. |
| | 109 | | /// </summary> |
| | 110 | | /// <remarks> |
| | 111 | | /// The ID can contain any combination of alphanumeric characters |
| | 112 | | /// including hyphens and underscores and cannot contain more than 64 |
| | 113 | | /// characters. If you do not specify this property, the Batch service |
| | 114 | | /// assigns a default value of 'jobpreparation'. No other Task in the |
| | 115 | | /// Job can have the same ID as the Job Preparation Task. If you try to |
| | 116 | | /// submit a Task with the same id, the Batch service rejects the |
| | 117 | | /// request with error code TaskIdSameAsJobPreparationTask; if you are |
| | 118 | | /// calling the REST API directly, the HTTP status code is 409 |
| | 119 | | /// (Conflict). |
| | 120 | | /// </remarks> |
| | 121 | | [JsonProperty(PropertyName = "id")] |
| 2328 | 122 | | public string Id { get; set; } |
| | 123 | |
|
| | 124 | | /// <summary> |
| | 125 | | /// Gets or sets the command line of the Job Preparation Task. |
| | 126 | | /// </summary> |
| | 127 | | /// <remarks> |
| | 128 | | /// The command line does not run under a shell, and therefore cannot |
| | 129 | | /// take advantage of shell features such as environment variable |
| | 130 | | /// expansion. If you want to take advantage of such features, you |
| | 131 | | /// should invoke the shell in the command line, for example using "cmd |
| | 132 | | /// /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the |
| | 133 | | /// command line refers to file paths, it should use a relative path |
| | 134 | | /// (relative to the Task working directory), or use the Batch provided |
| | 135 | | /// environment variable |
| | 136 | | /// (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). |
| | 137 | | /// </remarks> |
| | 138 | | [JsonProperty(PropertyName = "commandLine")] |
| 2337 | 139 | | public string CommandLine { get; set; } |
| | 140 | |
|
| | 141 | | /// <summary> |
| | 142 | | /// Gets or sets the settings for the container under which the Job |
| | 143 | | /// Preparation Task runs. |
| | 144 | | /// </summary> |
| | 145 | | /// <remarks> |
| | 146 | | /// When this is specified, all directories recursively below the |
| | 147 | | /// AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the |
| | 148 | | /// node) are mapped into the container, all Task environment variables |
| | 149 | | /// are mapped into the container, and the Task command line is |
| | 150 | | /// executed in the container. Files produced in the container outside |
| | 151 | | /// of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, |
| | 152 | | /// meaning that Batch file APIs will not be able to access those |
| | 153 | | /// files. |
| | 154 | | /// </remarks> |
| | 155 | | [JsonProperty(PropertyName = "containerSettings")] |
| 2326 | 156 | | public TaskContainerSettings ContainerSettings { get; set; } |
| | 157 | |
|
| | 158 | | /// <summary> |
| | 159 | | /// Gets or sets a list of files that the Batch service will download |
| | 160 | | /// to the Compute Node before running the command line. |
| | 161 | | /// </summary> |
| | 162 | | /// <remarks> |
| | 163 | | /// Files listed under this element are located in the Task's working |
| | 164 | | /// directory. There is a maximum size for the list of resource files. |
| | 165 | | /// When the max size is exceeded, the request will fail and the |
| | 166 | | /// response error code will be RequestEntityTooLarge. If this occurs, |
| | 167 | | /// the collection of ResourceFiles must be reduced in size. This can |
| | 168 | | /// be achieved using .zip files, Application Packages, or Docker |
| | 169 | | /// Containers. |
| | 170 | | /// </remarks> |
| | 171 | | [JsonProperty(PropertyName = "resourceFiles")] |
| 2344 | 172 | | public IList<ResourceFile> ResourceFiles { get; set; } |
| | 173 | |
|
| | 174 | | /// <summary> |
| | 175 | | /// Gets or sets a list of environment variable settings for the Job |
| | 176 | | /// Preparation Task. |
| | 177 | | /// </summary> |
| | 178 | | [JsonProperty(PropertyName = "environmentSettings")] |
| 2337 | 179 | | public IList<EnvironmentSetting> EnvironmentSettings { get; set; } |
| | 180 | |
|
| | 181 | | /// <summary> |
| | 182 | | /// Gets or sets constraints that apply to the Job Preparation Task. |
| | 183 | | /// </summary> |
| | 184 | | [JsonProperty(PropertyName = "constraints")] |
| 2323 | 185 | | public TaskConstraints Constraints { get; set; } |
| | 186 | |
|
| | 187 | | /// <summary> |
| | 188 | | /// Gets or sets whether the Batch service should wait for the Job |
| | 189 | | /// Preparation Task to complete successfully before scheduling any |
| | 190 | | /// other Tasks of the Job on the Compute Node. A Job Preparation Task |
| | 191 | | /// has completed successfully if it exits with exit code 0. |
| | 192 | | /// </summary> |
| | 193 | | /// <remarks> |
| | 194 | | /// If true and the Job Preparation Task fails on a Node, the Batch |
| | 195 | | /// service retries the Job Preparation Task up to its maximum retry |
| | 196 | | /// count (as specified in the constraints element). If the Task has |
| | 197 | | /// still not completed successfully after all retries, then the Batch |
| | 198 | | /// service will not schedule Tasks of the Job to the Node. The Node |
| | 199 | | /// remains active and eligible to run Tasks of other Jobs. If false, |
| | 200 | | /// the Batch service will not wait for the Job Preparation Task to |
| | 201 | | /// complete. In this case, other Tasks of the Job can start executing |
| | 202 | | /// on the Compute Node while the Job Preparation Task is still |
| | 203 | | /// running; and even if the Job Preparation Task fails, new Tasks will |
| | 204 | | /// continue to be scheduled on the Compute Node. The default value is |
| | 205 | | /// true. |
| | 206 | | /// </remarks> |
| | 207 | | [JsonProperty(PropertyName = "waitForSuccess")] |
| 2334 | 208 | | public bool? WaitForSuccess { get; set; } |
| | 209 | |
|
| | 210 | | /// <summary> |
| | 211 | | /// Gets or sets the user identity under which the Job Preparation Task |
| | 212 | | /// runs. |
| | 213 | | /// </summary> |
| | 214 | | /// <remarks> |
| | 215 | | /// If omitted, the Task runs as a non-administrative user unique to |
| | 216 | | /// the Task on Windows Compute Nodes, or a non-administrative user |
| | 217 | | /// unique to the Pool on Linux Compute Nodes. |
| | 218 | | /// </remarks> |
| | 219 | | [JsonProperty(PropertyName = "userIdentity")] |
| 2344 | 220 | | public UserIdentity UserIdentity { get; set; } |
| | 221 | |
|
| | 222 | | /// <summary> |
| | 223 | | /// Gets or sets whether the Batch service should rerun the Job |
| | 224 | | /// Preparation Task after a Compute Node reboots. |
| | 225 | | /// </summary> |
| | 226 | | /// <remarks> |
| | 227 | | /// The Job Preparation Task is always rerun if a Compute Node is |
| | 228 | | /// reimaged, or if the Job Preparation Task did not complete (e.g. |
| | 229 | | /// because the reboot occurred while the Task was running). Therefore, |
| | 230 | | /// you should always write a Job Preparation Task to be idempotent and |
| | 231 | | /// to behave correctly if run multiple times. The default value is |
| | 232 | | /// true. |
| | 233 | | /// </remarks> |
| | 234 | | [JsonProperty(PropertyName = "rerunOnNodeRebootAfterSuccess")] |
| 2335 | 235 | | public bool? RerunOnNodeRebootAfterSuccess { get; set; } |
| | 236 | |
|
| | 237 | | } |
| | 238 | | } |