Google Cloud Batch V1 Client - Class TaskSpec (0.6.0)

Reference documentation and code samples for the Google Cloud Batch V1 Client class TaskSpec.

Spec of a task

Generated from protobuf message google.cloud.batch.v1.TaskSpec

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ runnables array<Google\Cloud\Batch\V1\Runnable>

The sequence of scripts or containers to run for this Task. Each Task using this TaskSpec executes its list of runnables in order. The Task succeeds if all of its runnables either exit with a zero status or any that exit with a non-zero status have the ignore_exit_status flag. Background runnables are killed automatically (if they have not already exited) a short time after all foreground runnables have completed. Even though this is likely to result in a non-zero exit status for the background runnable, these automatic kills are not treated as Task failures.

↳ compute_resource Google\Cloud\Batch\V1\ComputeResource

ComputeResource requirements.

↳ max_run_duration Google\Protobuf\Duration

Maximum duration the task should run. The task will be killed and marked as FAILED if over this limit.

↳ max_retry_count int

Maximum number of retries on failures. The default, 0, which means never retry. The valid value range is [0, 10].

↳ lifecycle_policies array<Google\Cloud\Batch\V1\LifecyclePolicy>

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.

↳ environments array|Google\Protobuf\Internal\MapField

Deprecated: please use environment(non-plural) instead.

↳ volumes array<Google\Cloud\Batch\V1\Volume>

Volumes to mount before running Tasks using this TaskSpec.

↳ environment Google\Cloud\Batch\V1\Environment

Environment variables to set before running the Task.

getRunnables

The sequence of scripts or containers to run for this Task. Each Task using this TaskSpec executes its list of runnables in order. The Task succeeds if all of its runnables either exit with a zero status or any that exit with a non-zero status have the ignore_exit_status flag.

Background runnables are killed automatically (if they have not already exited) a short time after all foreground runnables have completed. Even though this is likely to result in a non-zero exit status for the background runnable, these automatic kills are not treated as Task failures.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setRunnables

The sequence of scripts or containers to run for this Task. Each Task using this TaskSpec executes its list of runnables in order. The Task succeeds if all of its runnables either exit with a zero status or any that exit with a non-zero status have the ignore_exit_status flag.

Background runnables are killed automatically (if they have not already exited) a short time after all foreground runnables have completed. Even though this is likely to result in a non-zero exit status for the background runnable, these automatic kills are not treated as Task failures.

Parameter
NameDescription
var array<Google\Cloud\Batch\V1\Runnable>
Returns
TypeDescription
$this

getComputeResource

ComputeResource requirements.

Returns
TypeDescription
Google\Cloud\Batch\V1\ComputeResource|null

hasComputeResource

clearComputeResource

setComputeResource

ComputeResource requirements.

Parameter
NameDescription
var Google\Cloud\Batch\V1\ComputeResource
Returns
TypeDescription
$this

getMaxRunDuration

Maximum duration the task should run.

The task will be killed and marked as FAILED if over this limit.

Returns
TypeDescription
Google\Protobuf\Duration|null

hasMaxRunDuration

clearMaxRunDuration

setMaxRunDuration

Maximum duration the task should run.

The task will be killed and marked as FAILED if over this limit.

Parameter
NameDescription
var Google\Protobuf\Duration
Returns
TypeDescription
$this

getMaxRetryCount

Maximum number of retries on failures.

The default, 0, which means never retry. The valid value range is [0, 10].

Returns
TypeDescription
int

setMaxRetryCount

Maximum number of retries on failures.

The default, 0, which means never retry. The valid value range is [0, 10].

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getLifecyclePolicies

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.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setLifecyclePolicies

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.

Parameter
NameDescription
var array<Google\Cloud\Batch\V1\LifecyclePolicy>
Returns
TypeDescription
$this

getEnvironments

Deprecated: please use environment(non-plural) instead.

Returns
TypeDescription
Google\Protobuf\Internal\MapField

setEnvironments

Deprecated: please use environment(non-plural) instead.

Parameter
NameDescription
var array|Google\Protobuf\Internal\MapField
Returns
TypeDescription
$this

getVolumes

Volumes to mount before running Tasks using this TaskSpec.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setVolumes

Volumes to mount before running Tasks using this TaskSpec.

Parameter
NameDescription
var array<Google\Cloud\Batch\V1\Volume>
Returns
TypeDescription
$this

getEnvironment

Environment variables to set before running the Task.

Returns
TypeDescription
Google\Cloud\Batch\V1\Environment|null

hasEnvironment

clearEnvironment

setEnvironment

Environment variables to set before running the Task.

Parameter
NameDescription
var Google\Cloud\Batch\V1\Environment
Returns
TypeDescription
$this