-
Notifications
You must be signed in to change notification settings - Fork 460
Expand file tree
/
Copy pathTaskSpec.php
More file actions
444 lines (408 loc) · 17 KB
/
TaskSpec.php
File metadata and controls
444 lines (408 loc) · 17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/batch/v1/task.proto
namespace Google\Cloud\Batch\V1;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;
/**
* Spec of a task
*
* Generated from protobuf message <code>google.cloud.batch.v1.TaskSpec</code>
*/
class TaskSpec extends \Google\Protobuf\Internal\Message
{
/**
* Required. The sequence of one or more runnables (executable scripts,
* executable containers, and/or barriers) for each task in this task group to
* run. Each task runs this list of runnables in order. For a task to succeed,
* all of its script and container runnables each must meet at least one of
* the following conditions:
* + The runnable exited with a zero status.
* + The runnable didn't finish, but you enabled its `background` subfield.
* + The runnable exited with a non-zero status, but you enabled its
* `ignore_exit_status` subfield.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Runnable runnables = 8;</code>
*/
private $runnables;
/**
* ComputeResource requirements.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.ComputeResource compute_resource = 3;</code>
*/
protected $compute_resource = null;
/**
* Maximum duration the task should run before being automatically retried
* (if enabled) or automatically failed. Format the value of this field
* as a time limit in seconds followed by `s`—for example, `3600s`
* for 1 hour. The field accepts any value between 0 and the maximum listed
* for the `Duration` field type at
* https://protobuf.dev/reference/protobuf/google.protobuf/#duration; however,
* the actual maximum run time for a job will be limited to the maximum run
* time for a job listed at
* https://cloud.google.com/batch/quotas#max-job-duration.
*
* Generated from protobuf field <code>.google.protobuf.Duration max_run_duration = 4;</code>
*/
protected $max_run_duration = null;
/**
* Maximum number of retries on failures.
* The default, 0, which means never retry.
* The valid value range is [0, 10].
*
* Generated from protobuf field <code>int32 max_retry_count = 5;</code>
*/
protected $max_retry_count = 0;
/**
* Lifecycle management schema when any task in a task group is failed.
* Currently we only support one lifecycle policy.
* When the lifecycle policy condition is met,
* the action in the policy will execute.
* If task execution result does not meet with the defined lifecycle
* policy, we consider it as the default policy.
* Default policy means if the exit code is 0, exit task.
* If task ends with non-zero exit code, retry the task with max_retry_count.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.LifecyclePolicy lifecycle_policies = 9;</code>
*/
private $lifecycle_policies;
/**
* Deprecated: please use environment(non-plural) instead.
*
* Generated from protobuf field <code>map<string, string> environments = 6 [deprecated = true];</code>
* @deprecated
*/
private $environments;
/**
* Volumes to mount before running Tasks using this TaskSpec.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Volume volumes = 7;</code>
*/
private $volumes;
/**
* Environment variables to set before running the Task.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.Environment environment = 10;</code>
*/
protected $environment = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Cloud\Batch\V1\Runnable[] $runnables
* Required. The sequence of one or more runnables (executable scripts,
* executable containers, and/or barriers) for each task in this task group to
* run. Each task runs this list of runnables in order. For a task to succeed,
* all of its script and container runnables each must meet at least one of
* the following conditions:
* + The runnable exited with a zero status.
* + The runnable didn't finish, but you enabled its `background` subfield.
* + The runnable exited with a non-zero status, but you enabled its
* `ignore_exit_status` subfield.
* @type \Google\Cloud\Batch\V1\ComputeResource $compute_resource
* ComputeResource requirements.
* @type \Google\Protobuf\Duration $max_run_duration
* Maximum duration the task should run before being automatically retried
* (if enabled) or automatically failed. Format the value of this field
* as a time limit in seconds followed by `s`—for example, `3600s`
* for 1 hour. The field accepts any value between 0 and the maximum listed
* for the `Duration` field type at
* https://protobuf.dev/reference/protobuf/google.protobuf/#duration; however,
* the actual maximum run time for a job will be limited to the maximum run
* time for a job listed at
* https://cloud.google.com/batch/quotas#max-job-duration.
* @type int $max_retry_count
* Maximum number of retries on failures.
* The default, 0, which means never retry.
* The valid value range is [0, 10].
* @type \Google\Cloud\Batch\V1\LifecyclePolicy[] $lifecycle_policies
* Lifecycle management schema when any task in a task group is failed.
* Currently we only support one lifecycle policy.
* When the lifecycle policy condition is met,
* the action in the policy will execute.
* If task execution result does not meet with the defined lifecycle
* policy, we consider it as the default policy.
* Default policy means if the exit code is 0, exit task.
* If task ends with non-zero exit code, retry the task with max_retry_count.
* @type array|\Google\Protobuf\Internal\MapField $environments
* Deprecated: please use environment(non-plural) instead.
* @type \Google\Cloud\Batch\V1\Volume[] $volumes
* Volumes to mount before running Tasks using this TaskSpec.
* @type \Google\Cloud\Batch\V1\Environment $environment
* Environment variables to set before running the Task.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Batch\V1\Task::initOnce();
parent::__construct($data);
}
/**
* Required. The sequence of one or more runnables (executable scripts,
* executable containers, and/or barriers) for each task in this task group to
* run. Each task runs this list of runnables in order. For a task to succeed,
* all of its script and container runnables each must meet at least one of
* the following conditions:
* + The runnable exited with a zero status.
* + The runnable didn't finish, but you enabled its `background` subfield.
* + The runnable exited with a non-zero status, but you enabled its
* `ignore_exit_status` subfield.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Runnable runnables = 8;</code>
* @return RepeatedField<\Google\Cloud\Batch\V1\Runnable>
*/
public function getRunnables()
{
return $this->runnables;
}
/**
* Required. The sequence of one or more runnables (executable scripts,
* executable containers, and/or barriers) for each task in this task group to
* run. Each task runs this list of runnables in order. For a task to succeed,
* all of its script and container runnables each must meet at least one of
* the following conditions:
* + The runnable exited with a zero status.
* + The runnable didn't finish, but you enabled its `background` subfield.
* + The runnable exited with a non-zero status, but you enabled its
* `ignore_exit_status` subfield.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Runnable runnables = 8;</code>
* @param \Google\Cloud\Batch\V1\Runnable[] $var
* @return $this
*/
public function setRunnables($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Batch\V1\Runnable::class);
$this->runnables = $arr;
return $this;
}
/**
* ComputeResource requirements.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.ComputeResource compute_resource = 3;</code>
* @return \Google\Cloud\Batch\V1\ComputeResource|null
*/
public function getComputeResource()
{
return $this->compute_resource;
}
public function hasComputeResource()
{
return isset($this->compute_resource);
}
public function clearComputeResource()
{
unset($this->compute_resource);
}
/**
* ComputeResource requirements.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.ComputeResource compute_resource = 3;</code>
* @param \Google\Cloud\Batch\V1\ComputeResource $var
* @return $this
*/
public function setComputeResource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\ComputeResource::class);
$this->compute_resource = $var;
return $this;
}
/**
* Maximum duration the task should run before being automatically retried
* (if enabled) or automatically failed. Format the value of this field
* as a time limit in seconds followed by `s`—for example, `3600s`
* for 1 hour. The field accepts any value between 0 and the maximum listed
* for the `Duration` field type at
* https://protobuf.dev/reference/protobuf/google.protobuf/#duration; however,
* the actual maximum run time for a job will be limited to the maximum run
* time for a job listed at
* https://cloud.google.com/batch/quotas#max-job-duration.
*
* Generated from protobuf field <code>.google.protobuf.Duration max_run_duration = 4;</code>
* @return \Google\Protobuf\Duration|null
*/
public function getMaxRunDuration()
{
return $this->max_run_duration;
}
public function hasMaxRunDuration()
{
return isset($this->max_run_duration);
}
public function clearMaxRunDuration()
{
unset($this->max_run_duration);
}
/**
* Maximum duration the task should run before being automatically retried
* (if enabled) or automatically failed. Format the value of this field
* as a time limit in seconds followed by `s`—for example, `3600s`
* for 1 hour. The field accepts any value between 0 and the maximum listed
* for the `Duration` field type at
* https://protobuf.dev/reference/protobuf/google.protobuf/#duration; however,
* the actual maximum run time for a job will be limited to the maximum run
* time for a job listed at
* https://cloud.google.com/batch/quotas#max-job-duration.
*
* Generated from protobuf field <code>.google.protobuf.Duration max_run_duration = 4;</code>
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setMaxRunDuration($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->max_run_duration = $var;
return $this;
}
/**
* Maximum number of retries on failures.
* The default, 0, which means never retry.
* The valid value range is [0, 10].
*
* Generated from protobuf field <code>int32 max_retry_count = 5;</code>
* @return int
*/
public function getMaxRetryCount()
{
return $this->max_retry_count;
}
/**
* Maximum number of retries on failures.
* The default, 0, which means never retry.
* The valid value range is [0, 10].
*
* Generated from protobuf field <code>int32 max_retry_count = 5;</code>
* @param int $var
* @return $this
*/
public function setMaxRetryCount($var)
{
GPBUtil::checkInt32($var);
$this->max_retry_count = $var;
return $this;
}
/**
* Lifecycle management schema when any task in a task group is failed.
* Currently we only support one lifecycle policy.
* When the lifecycle policy condition is met,
* the action in the policy will execute.
* If task execution result does not meet with the defined lifecycle
* policy, we consider it as the default policy.
* Default policy means if the exit code is 0, exit task.
* If task ends with non-zero exit code, retry the task with max_retry_count.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.LifecyclePolicy lifecycle_policies = 9;</code>
* @return RepeatedField<\Google\Cloud\Batch\V1\LifecyclePolicy>
*/
public function getLifecyclePolicies()
{
return $this->lifecycle_policies;
}
/**
* Lifecycle management schema when any task in a task group is failed.
* Currently we only support one lifecycle policy.
* When the lifecycle policy condition is met,
* the action in the policy will execute.
* If task execution result does not meet with the defined lifecycle
* policy, we consider it as the default policy.
* Default policy means if the exit code is 0, exit task.
* If task ends with non-zero exit code, retry the task with max_retry_count.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.LifecyclePolicy lifecycle_policies = 9;</code>
* @param \Google\Cloud\Batch\V1\LifecyclePolicy[] $var
* @return $this
*/
public function setLifecyclePolicies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Batch\V1\LifecyclePolicy::class);
$this->lifecycle_policies = $arr;
return $this;
}
/**
* Deprecated: please use environment(non-plural) instead.
*
* Generated from protobuf field <code>map<string, string> environments = 6 [deprecated = true];</code>
* @return \Google\Protobuf\Internal\MapField
* @deprecated
*/
public function getEnvironments()
{
if ($this->environments->count() !== 0) {
@trigger_error('environments is deprecated.', E_USER_DEPRECATED);
}
return $this->environments;
}
/**
* Deprecated: please use environment(non-plural) instead.
*
* Generated from protobuf field <code>map<string, string> environments = 6 [deprecated = true];</code>
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
* @deprecated
*/
public function setEnvironments($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
if (count($arr) !== 0) {
@trigger_error('environments is deprecated.', E_USER_DEPRECATED);
}
$this->environments = $arr;
return $this;
}
/**
* Volumes to mount before running Tasks using this TaskSpec.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Volume volumes = 7;</code>
* @return RepeatedField<\Google\Cloud\Batch\V1\Volume>
*/
public function getVolumes()
{
return $this->volumes;
}
/**
* Volumes to mount before running Tasks using this TaskSpec.
*
* Generated from protobuf field <code>repeated .google.cloud.batch.v1.Volume volumes = 7;</code>
* @param \Google\Cloud\Batch\V1\Volume[] $var
* @return $this
*/
public function setVolumes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Batch\V1\Volume::class);
$this->volumes = $arr;
return $this;
}
/**
* Environment variables to set before running the Task.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.Environment environment = 10;</code>
* @return \Google\Cloud\Batch\V1\Environment|null
*/
public function getEnvironment()
{
return $this->environment;
}
public function hasEnvironment()
{
return isset($this->environment);
}
public function clearEnvironment()
{
unset($this->environment);
}
/**
* Environment variables to set before running the Task.
*
* Generated from protobuf field <code>.google.cloud.batch.v1.Environment environment = 10;</code>
* @param \Google\Cloud\Batch\V1\Environment $var
* @return $this
*/
public function setEnvironment($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\Environment::class);
$this->environment = $var;
return $this;
}
}