View Javadoc
1   // Copyright (c) Microsoft Corporation. All rights reserved.
2   // Licensed under the MIT License.
3   // Code generated by Microsoft (R) AutoRest Code Generator
4   
5   package com.microsoft.azure.batch.protocol.models;
6   
7   import java.util.List;
8   import com.fasterxml.jackson.annotation.JsonProperty;
9   
10  /**
11   * An Azure Batch task to add.
12   * Batch will retry tasks when a recovery operation is triggered on a compute
13   * node. Examples of recovery operations include (but are not limited to) when
14   * an unhealthy compute node is rebooted or a compute node disappeared due to
15   * host failure. Retries due to recovery operations are independent of and are
16   * not counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is
17   * 0, an internal retry due to a recovery operation may occur. Because of this,
18   * all tasks should be idempotent. This means tasks need to tolerate being
19   * interrupted and restarted without causing any corruption or duplicate data.
20   * The best practice for long running tasks is to use some form of
21   * checkpointing.
22   */
23  public class TaskAddParameter {
24      /**
25       * A string that uniquely identifies the task within the job.
26       * The ID can contain any combination of alphanumeric characters including
27       * hyphens and underscores, and cannot contain more than 64 characters. The
28       * ID is case-preserving and case-insensitive (that is, you may not have
29       * two IDs within a job that differ only by case).
30       */
31      @JsonProperty(value = "id", required = true)
32      private String id;
33  
34      /**
35       * A display name for the task.
36       * The display name need not be unique and can contain any Unicode
37       * characters up to a maximum length of 1024.
38       */
39      @JsonProperty(value = "displayName")
40      private String displayName;
41  
42      /**
43       * The command line of the task.
44       * For multi-instance tasks, the command line is executed as the primary
45       * task, after the primary task and all subtasks have finished executing
46       * the coordination command line. The command line does not run under a
47       * shell, and therefore cannot take advantage of shell features such as
48       * environment variable expansion. If you want to take advantage of such
49       * features, you should invoke the shell in the command line, for example
50       * using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.
51       * If the command line refers to file paths, it should use a relative path
52       * (relative to the task working directory), or use the Batch provided
53       * environment variable
54       * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables).
55       */
56      @JsonProperty(value = "commandLine", required = true)
57      private String commandLine;
58  
59      /**
60       * The settings for the container under which the task runs.
61       * If the pool that will run this task has containerConfiguration set, this
62       * must be set as well. If the pool that will run this task doesn't have
63       * containerConfiguration set, this must not be set. When this is
64       * specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR
65       * (the root of Azure Batch directories on the node) are mapped into the
66       * container, all task environment variables are mapped into the container,
67       * and the task command line is executed in the container.
68       */
69      @JsonProperty(value = "containerSettings")
70      private TaskContainerSettings containerSettings;
71  
72      /**
73       * How the Batch service should respond when the task completes.
74       */
75      @JsonProperty(value = "exitConditions")
76      private ExitConditions exitConditions;
77  
78      /**
79       * A list of files that the Batch service will download to the compute node
80       * before running the command line.
81       * For multi-instance tasks, the resource files will only be downloaded to
82       * the compute node on which the primary task is executed. There is a
83       * maximum size for the list of resource files.  When the max size is
84       * exceeded, the request will fail and the response error code will be
85       * RequestEntityTooLarge. If this occurs, the collection of ResourceFiles
86       * must be reduced in size. This can be achieved using .zip files,
87       * Application Packages, or Docker Containers.
88       */
89      @JsonProperty(value = "resourceFiles")
90      private List<ResourceFile> resourceFiles;
91  
92      /**
93       * A list of files that the Batch service will upload from the compute node
94       * after running the command line.
95       * For multi-instance tasks, the files will only be uploaded from the
96       * compute node on which the primary task is executed.
97       */
98      @JsonProperty(value = "outputFiles")
99      private List<OutputFile> outputFiles;
100 
101     /**
102      * A list of environment variable settings for the task.
103      */
104     @JsonProperty(value = "environmentSettings")
105     private List<EnvironmentSetting> environmentSettings;
106 
107     /**
108      * A locality hint that can be used by the Batch service to select a
109      * compute node on which to start the new task.
110      */
111     @JsonProperty(value = "affinityInfo")
112     private AffinityInformation affinityInfo;
113 
114     /**
115      * The execution constraints that apply to this task.
116      * If you do not specify constraints, the maxTaskRetryCount is the
117      * maxTaskRetryCount specified for the job, the maxWallClockTime is
118      * infinite, and the retentionTime is 7 days.
119      */
120     @JsonProperty(value = "constraints")
121     private TaskConstraints constraints;
122 
123     /**
124      * The user identity under which the task runs.
125      * If omitted, the task runs as a non-administrative user unique to the
126      * task.
127      */
128     @JsonProperty(value = "userIdentity")
129     private UserIdentity userIdentity;
130 
131     /**
132      * An object that indicates that the task is a multi-instance task, and
133      * contains information about how to run the multi-instance task.
134      */
135     @JsonProperty(value = "multiInstanceSettings")
136     private MultiInstanceSettings multiInstanceSettings;
137 
138     /**
139      * The tasks that this task depends on.
140      * This task will not be scheduled until all tasks that it depends on have
141      * completed successfully. If any of those tasks fail and exhaust their
142      * retry counts, this task will never be scheduled. If the job does not
143      * have usesTaskDependencies set to true, and this element is present, the
144      * request fails with error code TaskDependenciesNotSpecifiedOnJob.
145      */
146     @JsonProperty(value = "dependsOn")
147     private TaskDependencies dependsOn;
148 
149     /**
150      * A list of application packages that the Batch service will deploy to the
151      * compute node before running the command line.
152      * Application packages are downloaded and deployed to a shared directory,
153      * not the task working directory. Therefore, if a referenced package is
154      * already on the compute node, and is up to date, then it is not
155      * re-downloaded; the existing copy on the compute node is used. If a
156      * referenced application package cannot be installed, for example because
157      * the package has been deleted or because download failed, the task fails.
158      */
159     @JsonProperty(value = "applicationPackageReferences")
160     private List<ApplicationPackageReference> applicationPackageReferences;
161 
162     /**
163      * The settings for an authentication token that the task can use to
164      * perform Batch service operations.
165      * If this property is set, the Batch service provides the task with an
166      * authentication token which can be used to authenticate Batch service
167      * operations without requiring an account access key. The token is
168      * provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The
169      * operations that the task can carry out using the token depend on the
170      * settings. For example, a task can request job permissions in order to
171      * add other tasks to the job, or check the status of the job or of other
172      * tasks under the job.
173      */
174     @JsonProperty(value = "authenticationTokenSettings")
175     private AuthenticationTokenSettings authenticationTokenSettings;
176 
177     /**
178      * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case).
179      *
180      * @return the id value
181      */
182     public String id() {
183         return this.id;
184     }
185 
186     /**
187      * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case).
188      *
189      * @param id the id value to set
190      * @return the TaskAddParameter object itself.
191      */
192     public TaskAddParameter withId(String id) {
193         this.id = id;
194         return this;
195     }
196 
197     /**
198      * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
199      *
200      * @return the displayName value
201      */
202     public String displayName() {
203         return this.displayName;
204     }
205 
206     /**
207      * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
208      *
209      * @param displayName the displayName value to set
210      * @return the TaskAddParameter object itself.
211      */
212     public TaskAddParameter withDisplayName(String displayName) {
213         this.displayName = displayName;
214         return this;
215     }
216 
217     /**
218      * Get for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables).
219      *
220      * @return the commandLine value
221      */
222     public String commandLine() {
223         return this.commandLine;
224     }
225 
226     /**
227      * Set for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables).
228      *
229      * @param commandLine the commandLine value to set
230      * @return the TaskAddParameter object itself.
231      */
232     public TaskAddParameter withCommandLine(String commandLine) {
233         this.commandLine = commandLine;
234         return this;
235     }
236 
237     /**
238      * Get if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
239      *
240      * @return the containerSettings value
241      */
242     public TaskContainerSettings containerSettings() {
243         return this.containerSettings;
244     }
245 
246     /**
247      * Set if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
248      *
249      * @param containerSettings the containerSettings value to set
250      * @return the TaskAddParameter object itself.
251      */
252     public TaskAddParameter withContainerSettings(TaskContainerSettings containerSettings) {
253         this.containerSettings = containerSettings;
254         return this;
255     }
256 
257     /**
258      * Get how the Batch service should respond when the task completes.
259      *
260      * @return the exitConditions value
261      */
262     public ExitConditions exitConditions() {
263         return this.exitConditions;
264     }
265 
266     /**
267      * Set how the Batch service should respond when the task completes.
268      *
269      * @param exitConditions the exitConditions value to set
270      * @return the TaskAddParameter object itself.
271      */
272     public TaskAddParameter withExitConditions(ExitConditions exitConditions) {
273         this.exitConditions = exitConditions;
274         return this;
275     }
276 
277     /**
278      * Get for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files.  When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.
279      *
280      * @return the resourceFiles value
281      */
282     public List<ResourceFile> resourceFiles() {
283         return this.resourceFiles;
284     }
285 
286     /**
287      * Set for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files.  When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.
288      *
289      * @param resourceFiles the resourceFiles value to set
290      * @return the TaskAddParameter object itself.
291      */
292     public TaskAddParameter withResourceFiles(List<ResourceFile> resourceFiles) {
293         this.resourceFiles = resourceFiles;
294         return this;
295     }
296 
297     /**
298      * Get for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed.
299      *
300      * @return the outputFiles value
301      */
302     public List<OutputFile> outputFiles() {
303         return this.outputFiles;
304     }
305 
306     /**
307      * Set for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed.
308      *
309      * @param outputFiles the outputFiles value to set
310      * @return the TaskAddParameter object itself.
311      */
312     public TaskAddParameter withOutputFiles(List<OutputFile> outputFiles) {
313         this.outputFiles = outputFiles;
314         return this;
315     }
316 
317     /**
318      * Get the environmentSettings value.
319      *
320      * @return the environmentSettings value
321      */
322     public List<EnvironmentSetting> environmentSettings() {
323         return this.environmentSettings;
324     }
325 
326     /**
327      * Set the environmentSettings value.
328      *
329      * @param environmentSettings the environmentSettings value to set
330      * @return the TaskAddParameter object itself.
331      */
332     public TaskAddParameter withEnvironmentSettings(List<EnvironmentSetting> environmentSettings) {
333         this.environmentSettings = environmentSettings;
334         return this;
335     }
336 
337     /**
338      * Get the affinityInfo value.
339      *
340      * @return the affinityInfo value
341      */
342     public AffinityInformation affinityInfo() {
343         return this.affinityInfo;
344     }
345 
346     /**
347      * Set the affinityInfo value.
348      *
349      * @param affinityInfo the affinityInfo value to set
350      * @return the TaskAddParameter object itself.
351      */
352     public TaskAddParameter withAffinityInfo(AffinityInformation affinityInfo) {
353         this.affinityInfo = affinityInfo;
354         return this;
355     }
356 
357     /**
358      * Get if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days.
359      *
360      * @return the constraints value
361      */
362     public TaskConstraints constraints() {
363         return this.constraints;
364     }
365 
366     /**
367      * Set if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days.
368      *
369      * @param constraints the constraints value to set
370      * @return the TaskAddParameter object itself.
371      */
372     public TaskAddParameter withConstraints(TaskConstraints constraints) {
373         this.constraints = constraints;
374         return this;
375     }
376 
377     /**
378      * Get if omitted, the task runs as a non-administrative user unique to the task.
379      *
380      * @return the userIdentity value
381      */
382     public UserIdentity userIdentity() {
383         return this.userIdentity;
384     }
385 
386     /**
387      * Set if omitted, the task runs as a non-administrative user unique to the task.
388      *
389      * @param userIdentity the userIdentity value to set
390      * @return the TaskAddParameter object itself.
391      */
392     public TaskAddParameter withUserIdentity(UserIdentity userIdentity) {
393         this.userIdentity = userIdentity;
394         return this;
395     }
396 
397     /**
398      * Get the multiInstanceSettings value.
399      *
400      * @return the multiInstanceSettings value
401      */
402     public MultiInstanceSettings multiInstanceSettings() {
403         return this.multiInstanceSettings;
404     }
405 
406     /**
407      * Set the multiInstanceSettings value.
408      *
409      * @param multiInstanceSettings the multiInstanceSettings value to set
410      * @return the TaskAddParameter object itself.
411      */
412     public TaskAddParameter withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings) {
413         this.multiInstanceSettings = multiInstanceSettings;
414         return this;
415     }
416 
417     /**
418      * Get this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.
419      *
420      * @return the dependsOn value
421      */
422     public TaskDependencies dependsOn() {
423         return this.dependsOn;
424     }
425 
426     /**
427      * Set this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.
428      *
429      * @param dependsOn the dependsOn value to set
430      * @return the TaskAddParameter object itself.
431      */
432     public TaskAddParameter withDependsOn(TaskDependencies dependsOn) {
433         this.dependsOn = dependsOn;
434         return this;
435     }
436 
437     /**
438      * Get application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails.
439      *
440      * @return the applicationPackageReferences value
441      */
442     public List<ApplicationPackageReference> applicationPackageReferences() {
443         return this.applicationPackageReferences;
444     }
445 
446     /**
447      * Set application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails.
448      *
449      * @param applicationPackageReferences the applicationPackageReferences value to set
450      * @return the TaskAddParameter object itself.
451      */
452     public TaskAddParameter withApplicationPackageReferences(List<ApplicationPackageReference> applicationPackageReferences) {
453         this.applicationPackageReferences = applicationPackageReferences;
454         return this;
455     }
456 
457     /**
458      * Get if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job.
459      *
460      * @return the authenticationTokenSettings value
461      */
462     public AuthenticationTokenSettings authenticationTokenSettings() {
463         return this.authenticationTokenSettings;
464     }
465 
466     /**
467      * Set if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job.
468      *
469      * @param authenticationTokenSettings the authenticationTokenSettings value to set
470      * @return the TaskAddParameter object itself.
471      */
472     public TaskAddParameter withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings) {
473         this.authenticationTokenSettings = authenticationTokenSettings;
474         return this;
475     }
476 
477 }