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\u003eThis document provides reference documentation for the \u003ccode\u003eRunnable\u003c/code\u003e class within the Google Cloud Batch v1 API for .NET, detailing its properties, inheritance, and implementation of various interfaces.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRunnable\u003c/code\u003e class defines instructions for executing scripts or containers as part of a Task, with properties allowing configurations for background execution, conditional running on task failures, and ignoring exit statuses.\u003c/p\u003e\n"],["\u003cp\u003eMultiple versions of the \u003ccode\u003eRunnable\u003c/code\u003e class are available, with version 2.13.0 being the latest, and versions ranging from 1.0.0 up to 2.12.0 also being accessible, which are all listed in this document.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes several properties such as \u003ccode\u003eAlwaysRun\u003c/code\u003e, \u003ccode\u003eBackground\u003c/code\u003e, \u003ccode\u003eContainer\u003c/code\u003e, \u003ccode\u003eScript\u003c/code\u003e, and \u003ccode\u003eTimeout\u003c/code\u003e, to manage the execution behavior and characteristics of the runnable.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRunnable\u003c/code\u003e class offers constructors to initialize instances, either empty or based on an existing \u003ccode\u003eRunnable\u003c/code\u003e object, which can be used for the setup of tasks for execution.\u003c/p\u003e\n"]]],[],null,["# Batch v1 API - Class Runnable (2.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.0 (latest)](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.12.0/Google.Cloud.Batch.V1.Runnable)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.11.0/Google.Cloud.Batch.V1.Runnable)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.10.0/Google.Cloud.Batch.V1.Runnable)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.9.0/Google.Cloud.Batch.V1.Runnable)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.8.0/Google.Cloud.Batch.V1.Runnable)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.7.0/Google.Cloud.Batch.V1.Runnable)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.6.0/Google.Cloud.Batch.V1.Runnable)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.5.0/Google.Cloud.Batch.V1.Runnable)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.4.0/Google.Cloud.Batch.V1.Runnable)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.3.0/Google.Cloud.Batch.V1.Runnable)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.2.0/Google.Cloud.Batch.V1.Runnable)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.1.0/Google.Cloud.Batch.V1.Runnable)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/2.0.0/Google.Cloud.Batch.V1.Runnable)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.3.0/Google.Cloud.Batch.V1.Runnable)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.2.0/Google.Cloud.Batch.V1.Runnable)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.1.0/Google.Cloud.Batch.V1.Runnable)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Batch.V1/1.0.0/Google.Cloud.Batch.V1.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 v1 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.V1/latest/Google.Cloud.Batch.V1.Runnable), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.Runnable), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Runnable](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1.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.V1](/dotnet/docs/reference/Google.Cloud.Batch.V1/latest/Google.Cloud.Batch.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Batch.V1.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."]]