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 org.joda.time.Period;
8 import com.fasterxml.jackson.annotation.JsonProperty;
9
10 /**
11 * Execution constraints to apply to a task.
12 */
13 public class TaskConstraints {
14 /**
15 * The maximum elapsed time that the task may run, measured from the time
16 * the task starts. If the task does not complete within the time limit,
17 * the Batch service terminates it.
18 * If this is not specified, there is no time limit on how long the task
19 * may run.
20 */
21 @JsonProperty(value = "maxWallClockTime")
22 private Period maxWallClockTime;
23
24 /**
25 * The minimum time to retain the task directory on the compute node where
26 * it ran, from the time it completes execution. After this time, the Batch
27 * service may delete the task directory and all its contents.
28 * The default is 7 days, i.e. the task directory will be retained for 7
29 * days unless the compute node is removed or the job is deleted.
30 */
31 @JsonProperty(value = "retentionTime")
32 private Period retentionTime;
33
34 /**
35 * The maximum number of times the task may be retried. The Batch service
36 * retries a task if its exit code is nonzero.
37 * Note that this value specifically controls the number of retries for the
38 * task executable due to a nonzero exit code. The Batch service will try
39 * the task once, and may then retry up to this limit. For example, if the
40 * maximum retry count is 3, Batch tries the task up to 4 times (one
41 * initial try and 3 retries). If the maximum retry count is 0, the Batch
42 * service does not retry the task after the first attempt. If the maximum
43 * retry count is -1, the Batch service retries the task without limit.
44 */
45 @JsonProperty(value = "maxTaskRetryCount")
46 private Integer maxTaskRetryCount;
47
48 /**
49 * Get if this is not specified, there is no time limit on how long the task may run.
50 *
51 * @return the maxWallClockTime value
52 */
53 public Period maxWallClockTime() {
54 return this.maxWallClockTime;
55 }
56
57 /**
58 * Set if this is not specified, there is no time limit on how long the task may run.
59 *
60 * @param maxWallClockTime the maxWallClockTime value to set
61 * @return the TaskConstraints object itself.
62 */
63 public TaskConstraints withMaxWallClockTime(Period maxWallClockTime) {
64 this.maxWallClockTime = maxWallClockTime;
65 return this;
66 }
67
68 /**
69 * Get the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted.
70 *
71 * @return the retentionTime value
72 */
73 public Period retentionTime() {
74 return this.retentionTime;
75 }
76
77 /**
78 * Set the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted.
79 *
80 * @param retentionTime the retentionTime value to set
81 * @return the TaskConstraints object itself.
82 */
83 public TaskConstraints withRetentionTime(Period retentionTime) {
84 this.retentionTime = retentionTime;
85 return this;
86 }
87
88 /**
89 * Get note that this value specifically controls the number of retries for the task executable due to a nonzero exit code. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, the Batch service retries the task without limit.
90 *
91 * @return the maxTaskRetryCount value
92 */
93 public Integer maxTaskRetryCount() {
94 return this.maxTaskRetryCount;
95 }
96
97 /**
98 * Set note that this value specifically controls the number of retries for the task executable due to a nonzero exit code. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, the Batch service retries the task without limit.
99 *
100 * @param maxTaskRetryCount the maxTaskRetryCount value to set
101 * @return the TaskConstraints object itself.
102 */
103 public TaskConstraints withMaxTaskRetryCount(Integer maxTaskRetryCount) {
104 this.maxTaskRetryCount = maxTaskRetryCount;
105 return this;
106 }
107
108 }