# Google Cloud Batch V1 Client - Class LifecyclePolicy (1.4.1)

1.4.1 (latest) 1.4.0 1.3.1 1.2.2 1.1.7 1.0.3 0.17.0 0.16.10 0.15.0 0.14.0 0.13.1 0.12.1 0.11.3 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.2 0.4.0 0.3.0 0.2.2 Reference documentation and code samples for the Google Cloud Batch V1 Client class LifecyclePolicy.

LifecyclePolicy describes how to deal with task failures
based on different conditions.

Generated from protobuf message `google.cloud.batch.v1.LifecyclePolicy`

## Namespace

Google \\ Cloud \\ Batch \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ action` | `int` Action to execute when ActionCondition is true. When RETRY_TASK is specified, we will retry failed tasks if we notice any exit code match and fail tasks if no match is found. Likewise, when FAIL_TASK is specified, we will fail tasks if we notice any exit code match and retry tasks if no match is found. |
| `↳ action_condition` | `https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.LifecyclePolicy.ActionCondition` Conditions that decide why a task failure is dealt with a specific action. |

### getAction

Action to execute when ActionCondition is true.

When RETRY_TASK is specified, we will retry failed tasks
if we notice any exit code match and fail tasks if no match is found.
Likewise, when FAIL_TASK is specified, we will fail tasks
if we notice any exit code match and retry tasks if no match is found.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [Action](https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.LifecyclePolicy.Action). |

### setAction

Action to execute when ActionCondition is true.

When RETRY_TASK is specified, we will retry failed tasks
if we notice any exit code match and fail tasks if no match is found.
Likewise, when FAIL_TASK is specified, we will fail tasks
if we notice any exit code match and retry tasks if no match is found.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [Action](https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.LifecyclePolicy.Action). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getActionCondition

Conditions that decide why a task failure is dealt with a specific action.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.LifecyclePolicy.ActionCondition|null` |   |

### hasActionCondition

### clearActionCondition

### setActionCondition

Conditions that decide why a task failure is dealt with a specific action.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.LifecyclePolicy.ActionCondition` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |