public sealed class LifecyclePolicy : IMessage<LifecyclePolicy>, IEquatable<LifecyclePolicy>, IDeepCloneable<LifecyclePolicy>, IBufferMessage, IMessage
Reference documentation and code samples for the Batch v1alpha API class LifecyclePolicy.
LifecyclePolicy describes how to deal with task failures
based on different conditions.
public LifecyclePolicy.Types.Action Action { get; set; }
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eLifecyclePolicy\u003c/code\u003e is a class in the Google Cloud Batch v1alpha API that defines how to handle task failures based on specific conditions.\u003c/p\u003e\n"],["\u003cp\u003eIt implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, for functionalities like message handling, equality comparison, deep cloning, and buffer operations.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes properties like \u003ccode\u003eAction\u003c/code\u003e and \u003ccode\u003eActionCondition\u003c/code\u003e, which dictate the action to take (retry or fail) when certain conditions of task failure are met.\u003c/p\u003e\n"],["\u003cp\u003eThere are two constructors available for the \u003ccode\u003eLifecyclePolicy\u003c/code\u003e class: a default constructor, and a constructor that copies the properties of an existing \u003ccode\u003eLifecyclePolicy\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLifecyclePolicy\u003c/code\u003e inherits basic methods like \u003ccode\u003eGetHashCode\u003c/code\u003e, \u003ccode\u003eGetType\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e from the base \u003ccode\u003eobject\u003c/code\u003e class.\u003c/p\u003e\n"]]],[],null,["# Batch v1alpha API - Class LifecyclePolicy (1.0.0-alpha31)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.0-alpha31 (latest)](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.LifecyclePolicy)\n- [1.0.0-alpha30](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/1.0.0-alpha30/Google.Cloud.Batch.V1Alpha.LifecyclePolicy) \n\n public sealed class LifecyclePolicy : IMessage\u003cLifecyclePolicy\u003e, IEquatable\u003cLifecyclePolicy\u003e, IDeepCloneable\u003cLifecyclePolicy\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Batch v1alpha API class LifecyclePolicy.\n\nLifecyclePolicy describes how to deal with task failures\nbased on different conditions. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e LifecyclePolicy \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[LifecyclePolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.LifecyclePolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[LifecyclePolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.LifecyclePolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[LifecyclePolicy](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.LifecyclePolicy), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Batch.V1Alpha](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha)\n\nAssembly\n--------\n\nGoogle.Cloud.Batch.V1Alpha.dll\n\nConstructors\n------------\n\n### LifecyclePolicy()\n\n public LifecyclePolicy()\n\n### LifecyclePolicy(LifecyclePolicy)\n\n public LifecyclePolicy(LifecyclePolicy other)\n\nProperties\n----------\n\n### Action\n\n public LifecyclePolicy.Types.Action Action { get; set; }\n\nAction to execute when ActionCondition is true.\nWhen RETRY_TASK is specified, we will retry failed tasks\nif we notice any exit code match and fail tasks if no match is found.\nLikewise, when FAIL_TASK is specified, we will fail tasks\nif we notice any exit code match and retry tasks if no match is found.\n\n### ActionCondition\n\n public LifecyclePolicy.Types.ActionCondition ActionCondition { get; set; }\n\nConditions that decide why a task failure is dealt with a specific action."]]