By default, after a Runnable fails, no further Runnable are executed. This
flag indicates that this Runnable must be run even if the Task has already
failed. This is useful for Runnables that copy output files off of the VM
or for debugging.
The always_run flag does not override the Task's overall max_run_duration.
If the max_run_duration has expired then no further Runnables will execute,
not even always_run Runnables.
Normally, a runnable that doesn't exit causes its task to fail. However,
you can set this field to true to configure a background runnable.
Background runnables are allowed continue running in the background while
the task executes subsequent runnables. For example, background runnables
are useful for providing services to other runnables or providing
debugging-support tools like SSH servers.
Specifically, 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.
Optional. DisplayName is an optional field that can be provided by the
caller. If provided, it will be used in logs and other outputs to identify
the script, making it easier for users to understand the logs. If not
provided the index of the runnable will be used for outputs.
Normally, a runnable that returns a non-zero exit status fails and causes
the task to fail. However, you can set this field to true to allow the
task to continue executing its other runnables even if this runnable
fails.
[[["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\u003eRunnable is a class within the Batch v1alpha API that defines instructions for executing a script or container as part of a Task.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAlwaysRun\u003c/code\u003e property ensures a Runnable executes even if the Task has failed, useful for post-failure actions like file transfers or debugging, and will not override the max run duration set.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBackground\u003c/code\u003e property allows Runnables to run in the background while other tasks execute, which are beneficial for providing supporting services, and will be terminated after other runnables complete.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIgnoreExitStatus\u003c/code\u003e property can be set to allow a Task to continue even if a Runnable fails, enabling the execution of other Runnables.\u003c/p\u003e\n"],["\u003cp\u003eRunnable objects have properties like \u003ccode\u003eContainer\u003c/code\u003e, \u003ccode\u003eScript\u003c/code\u003e, and \u003ccode\u003eBarrier\u003c/code\u003e to configure different execution types, as well as supporting properties like \u003ccode\u003eDisplayName\u003c/code\u003e, \u003ccode\u003eLabels\u003c/code\u003e, \u003ccode\u003eTimeout\u003c/code\u003e, and \u003ccode\u003eEnvironment\u003c/code\u003e for further configuration and control of runnables.\u003c/p\u003e\n"]]],[],null,["# Batch v1alpha API - Class Runnable (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.Runnable)\n- [1.0.0-alpha30](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/1.0.0-alpha30/Google.Cloud.Batch.V1Alpha.Runnable) \n\n public sealed class Runnable : IMessage\u003cRunnable\u003e, IEquatable\u003cRunnable\u003e, IDeepCloneable\u003cRunnable\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Batch v1alpha API class Runnable.\n\nRunnable describes instructions for executing a specific script or container\nas part of a Task. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Runnable \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.Runnable), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.Runnable), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.Runnable), [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### Runnable()\n\n public Runnable()\n\n### Runnable(Runnable)\n\n public Runnable(Runnable other)\n\nProperties\n----------\n\n### AlwaysRun\n\n public bool AlwaysRun { get; set; }\n\nBy default, after a Runnable fails, no further Runnable are executed. This\nflag indicates that this Runnable must be run even if the Task has already\nfailed. This is useful for Runnables that copy output files off of the VM\nor for debugging.\n\nThe always_run flag does not override the Task's overall max_run_duration.\nIf the max_run_duration has expired then no further Runnables will execute,\nnot even always_run Runnables.\n\n### Background\n\n public bool Background { get; set; }\n\nNormally, a runnable that doesn't exit causes its task to fail. However,\nyou can set this field to `true` to configure a background runnable.\nBackground runnables are allowed continue running in the background while\nthe task executes subsequent runnables. For example, background runnables\nare useful for providing services to other runnables or providing\ndebugging-support tools like SSH servers.\n\nSpecifically, background runnables are killed automatically (if they have\nnot already exited) a short time after all foreground runnables have\ncompleted. Even though this is likely to result in a non-zero exit status\nfor the background runnable, these automatic kills are not treated as task\nfailures.\n\n### Barrier\n\n public Runnable.Types.Barrier Barrier { get; set; }\n\nBarrier runnable.\n\n### Container\n\n public Runnable.Types.Container Container { get; set; }\n\nContainer runnable.\n\n### DisplayName\n\n public string DisplayName { get; set; }\n\nOptional. DisplayName is an optional field that can be provided by the\ncaller. If provided, it will be used in logs and other outputs to identify\nthe script, making it easier for users to understand the logs. If not\nprovided the index of the runnable will be used for outputs.\n\n### Environment\n\n public Environment Environment { get; set; }\n\nEnvironment variables for this Runnable (overrides variables set for the\nwhole Task or TaskGroup).\n\n### ExecutableCase\n\n public Runnable.ExecutableOneofCase ExecutableCase { get; }\n\n### IgnoreExitStatus\n\n public bool IgnoreExitStatus { get; set; }\n\nNormally, a runnable that returns a non-zero exit status fails and causes\nthe task to fail. However, you can set this field to `true` to allow the\ntask to continue executing its other runnables even if this runnable\nfails.\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nLabels for this Runnable.\n\n### Script\n\n public Runnable.Types.Script Script { get; set; }\n\nScript runnable.\n\n### Timeout\n\n public Duration Timeout { get; set; }\n\nTimeout for this Runnable."]]