Labels for the TaskGroup.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
Output only. TaskGroup name.
The system generates this field based on parent Job name.
For example:
"projects/123456/locations/us-west1/jobs/job01/taskGroups/group01".
Max number of tasks that can run in parallel.
Default to min(task_count, parallel tasks per job limit).
See: Job Limits.
Field parallelism must be 1 if the scheduling_policy is IN_ORDER.
When true, Batch will populate a file with a list of all VMs assigned to
the TaskGroup and set the BATCH_HOSTS_FILE environment variable to the path
of that file. Defaults to false. The host file supports up to 1000 VMs.
Optional. If not set or set to false, Batch uses the root user to execute
runnables. If set to true, Batch runs the runnables using a non-root user.
Currently, the non-root user Batch used is generated by OS Login. For more
information, see About OS
Login.
public ServiceAccount ServiceAccount { get; set; }
Optional. ServiceAccount used by tasks within the task group for the access
to other Cloud resources. This allows tasks to operate with permissions
distinct from the service account for the VM set at AllocationPolicy. Use
this field when tasks require different access rights than those of the VM.
Specify the service account's email field. Ensure scopes
include any necessary permissions for tasks, in addition to the default
'cloud-platform' scope.
Max number of tasks that can be run on a VM at the same time.
If not specified, the system will decide a value based on available
compute resources on a VM and task requirements.
public RepeatedField<Environment> TaskEnvironments { get; }
An array of environment variable mappings, which are passed to Tasks with
matching indices. If task_environments is used then task_count should
not be specified in the request (and will be ignored). Task count will be
the length of task_environments.
Tasks get a BATCH_TASK_INDEX and BATCH_TASK_COUNT environment variable, in
addition to any environment variables set in task_environments, specifying
the number of Tasks in the Task's parent TaskGroup, and the specific Task's
index in the TaskGroup (0 through BATCH_TASK_COUNT - 1).
[[["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\u003eThe \u003ccode\u003eTaskGroup\u003c/code\u003e class in the Batch v1alpha API defines a group of tasks that share the same \u003ccode\u003eTaskSpec\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskGroup\u003c/code\u003e allows setting properties like \u003ccode\u003eAllocationPolicy\u003c/code\u003e, \u003ccode\u003eLabels\u003c/code\u003e, \u003ccode\u003eParallelism\u003c/code\u003e, and \u003ccode\u003eTaskCount\u003c/code\u003e to configure the execution of tasks within the group.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable features like passwordless SSH login between VMs within a \u003ccode\u003eTaskGroup\u003c/code\u003e with \u003ccode\u003ePermissiveSsh\u003c/code\u003e or manage task execution by non-root users with \u003ccode\u003eRunAsNonRoot\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskGroup\u003c/code\u003e includes settings to manage task environments, specifying \u003ccode\u003eTaskEnvironments\u003c/code\u003e and defining how many \u003ccode\u003eTaskCountPerNode\u003c/code\u003e can be run at the same time.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskGroup\u003c/code\u003e also provides the ability to set a specific \u003ccode\u003eServiceAccount\u003c/code\u003e to be used for tasks within the group, allowing for distinct permissions compared to the VM's service account.\u003c/p\u003e\n"]]],[],null,["# Batch v1alpha API - Class TaskGroup (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.TaskGroup)\n- [1.0.0-alpha30](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/1.0.0-alpha30/Google.Cloud.Batch.V1Alpha.TaskGroup) \n\n public sealed class TaskGroup : IMessage\u003cTaskGroup\u003e, IEquatable\u003cTaskGroup\u003e, IDeepCloneable\u003cTaskGroup\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Batch v1alpha API class TaskGroup.\n\nA TaskGroup defines one or more Tasks that all share the same TaskSpec. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e TaskGroup \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[TaskGroup](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.TaskGroup), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[TaskGroup](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.TaskGroup), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[TaskGroup](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.TaskGroup), [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### TaskGroup()\n\n public TaskGroup()\n\n### TaskGroup(TaskGroup)\n\n public TaskGroup(TaskGroup other)\n\nProperties\n----------\n\n### AllocationPolicy\n\n public AllocationPolicy AllocationPolicy { get; set; }\n\nCompute resource allocation for the TaskGroup.\nIf specified, it overrides resources in Job.\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nLabels for the TaskGroup.\nLabels could be user provided or system generated.\nYou can assign up to 64 labels. [Google Compute Engine label\nrestrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)\napply.\nLabel names that start with \"goog-\" or \"google-\" are reserved.\n\n### Name\n\n public string Name { get; set; }\n\nOutput only. TaskGroup name.\nThe system generates this field based on parent Job name.\nFor example:\n\"projects/123456/locations/us-west1/jobs/job01/taskGroups/group01\".\n\n### Parallelism\n\n public long Parallelism { get; set; }\n\nMax number of tasks that can run in parallel.\nDefault to min(task_count, parallel tasks per job limit).\nSee: [Job Limits](https://cloud.google.com/batch/quotas#job_limits).\nField parallelism must be 1 if the scheduling_policy is IN_ORDER.\n\n### PermissiveSsh\n\n public bool PermissiveSsh { get; set; }\n\nWhen true, Batch will configure SSH to allow passwordless login between\nVMs running the Batch tasks in the same TaskGroup.\n\n### RequireHostsFile\n\n public bool RequireHostsFile { get; set; }\n\nWhen true, Batch will populate a file with a list of all VMs assigned to\nthe TaskGroup and set the BATCH_HOSTS_FILE environment variable to the path\nof that file. Defaults to false. The host file supports up to 1000 VMs.\n\n### RunAsNonRoot\n\n public bool RunAsNonRoot { get; set; }\n\nOptional. If not set or set to false, Batch uses the root user to execute\nrunnables. If set to true, Batch runs the runnables using a non-root user.\nCurrently, the non-root user Batch used is generated by OS Login. For more\ninformation, see [About OS\nLogin](https://cloud.google.com/compute/docs/oslogin).\n\n### SchedulingPolicy\n\n public TaskGroup.Types.SchedulingPolicy SchedulingPolicy { get; set; }\n\nScheduling policy for Tasks in the TaskGroup.\nThe default value is AS_SOON_AS_POSSIBLE.\n\n### ServiceAccount\n\n public ServiceAccount ServiceAccount { get; set; }\n\nOptional. ServiceAccount used by tasks within the task group for the access\nto other Cloud resources. This allows tasks to operate with permissions\ndistinct from the service account for the VM set at `AllocationPolicy`. Use\nthis field when tasks require different access rights than those of the VM.\n\nSpecify the service account's `email` field. Ensure `scopes`\ninclude any necessary permissions for tasks, in addition to the default\n'cloud-platform' scope.\n\n### TaskCount\n\n public long TaskCount { get; set; }\n\nNumber of Tasks in the TaskGroup.\nDefault is 1.\n\n### TaskCountPerNode\n\n public long TaskCountPerNode { get; set; }\n\nMax number of tasks that can be run on a VM at the same time.\nIf not specified, the system will decide a value based on available\ncompute resources on a VM and task requirements.\n\n### TaskEnvironments\n\n public RepeatedField\u003cEnvironment\u003e TaskEnvironments { get; }\n\nAn array of environment variable mappings, which are passed to Tasks with\nmatching indices. If task_environments is used then task_count should\nnot be specified in the request (and will be ignored). Task count will be\nthe length of task_environments.\n\nTasks get a BATCH_TASK_INDEX and BATCH_TASK_COUNT environment variable, in\naddition to any environment variables set in task_environments, specifying\nthe number of Tasks in the Task's parent TaskGroup, and the specific Task's\nindex in the TaskGroup (0 through BATCH_TASK_COUNT - 1).\n\n### TaskGroupName\n\n public TaskGroupName TaskGroupName { get; set; }\n\n[TaskGroupName](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.TaskGroupName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.Batch.V1Alpha/latest/Google.Cloud.Batch.V1Alpha.TaskGroup#Google_Cloud_Batch_V1Alpha_TaskGroup_Name) resource name property.\n\n### TaskSpec\n\n public TaskSpec TaskSpec { get; set; }\n\nRequired. Tasks in the group share the same task spec."]]