NAME

Google::Cloud::Batch::V1alpha::Task - Compiled Protocol Buffers messages for google/cloud/batch/v1alpha/task.proto

SYNOPSIS

use Google::Cloud::Batch::V1alpha::Task;

my $msg = Google::Cloud::Batch::V1alpha::Task::ComputeResource->new({
    cpu_milli => $cpu_milli,
    memory_mib => $memory_mib,
    gpu_count => $gpu_count,
    boot_disk_mib => $boot_disk_mib,
});

# Read or update a field
my $val = $msg->cpu_milli();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Batch::V1alpha::Task::ComputeResource->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/batch/v1alpha/task.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Batch::V1alpha::Task::ComputeResource

Compute resource requirements.

ComputeResource defines the amount of resources required for each task. Make sure your tasks have enough resources to successfully run. If you also define the types of resources for a job to use with the [InstancePolicyOrTemplate](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate) field, make sure both fields are compatible with each other.

Inherits from Protobuf::Message.

Accessors

  • $msg->cpu_milli() / $msg->cpu_milli($value)

    Type: Int64

    The milliCPU count.

    `cpuMilli` defines the amount of CPU resources per task in milliCPU units. For example, `1000` corresponds to 1 vCPU per task. If undefined, the default value is `2000`.

    If you also define the VM's machine type using the `machineType` in [InstancePolicy](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy) field or inside the `instanceTemplate` in the [InstancePolicyOrTemplate](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate) field, make sure the CPU resources for both fields are compatible with each other and with how many tasks you want to allow to run on the same VM at the same time.

    For example, if you specify the `n2-standard-2` machine type, which has 2 vCPUs each, you are recommended to set `cpuMilli` no more than `2000`, or you are recommended to run two tasks on the same VM if you set `cpuMilli` to `1000` or less.

  • $msg->memory_mib() / $msg->memory_mib($value)

    Type: Int64

    Memory in MiB.

    `memoryMib` defines the amount of memory per task in MiB units. If undefined, the default value is `2000`. If you also define the VM's machine type using the `machineType` in [InstancePolicy](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy) field or inside the `instanceTemplate` in the [InstancePolicyOrTemplate](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate) field, make sure the memory resources for both fields are compatible with each other and with how many tasks you want to allow to run on the same VM at the same time.

    For example, if you specify the `n2-standard-2` machine type, which has 8 GiB each, you are recommended to set `memoryMib` to no more than `8192`, or you are recommended to run two tasks on the same VM if you set `memoryMib` to `4096` or less.

  • $msg->gpu_count() / $msg->gpu_count($value)

    Type: Int64

    The GPU count.

    Not yet implemented.

  • $msg->boot_disk_mib() / $msg->boot_disk_mib($value)

    Type: Int64

    Extra boot disk size in MiB for each task.

Google::Cloud::Batch::V1alpha::Task::StatusEvent

Status event.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Batch::V1alpha::Task::TaskExecution

This Task Execution field includes detail information for task execution procedures, based on StatusEvent types.

Inherits from Protobuf::Message.

Accessors

  • $msg->exit_code() / $msg->exit_code($value)

    Type: Int32

    The exit code of a finished task.

    If the task succeeded, the exit code will be 0. If the task failed but not due to the following reasons, the exit code will be 50000.

    Otherwise, it can be from different sources: * Batch known failures: https://cloud.google.com/batch/docs/troubleshooting#reserved-exit-codes. * Batch runnable execution failures; you can rely on Batch logs to further diagnose: https://cloud.google.com/batch/docs/analyze-job-using-logs. If there are multiple runnables failures, Batch only exposes the first error.

  • $msg->stderr_snippet() / $msg->stderr_snippet($value)

    Type: String

    Optional. The tail end of any content written to standard error by the task execution. This field will be populated only when the execution failed.

Google::Cloud::Batch::V1alpha::Task::TaskStatus

Status of a task.

Inherits from Protobuf::Message.

Accessors

Enum: TaskStatus::State

  • STATE_UNSPECIFIED => 0

  • PENDING => 1

  • ASSIGNED => 2

  • RUNNING => 3

  • FAILED => 4

  • SUCCEEDED => 5

  • UNEXECUTED => 6

Google::Cloud::Batch::V1alpha::Task::TaskResourceUsage

TaskResourceUsage describes the resource usage of the task.

Inherits from Protobuf::Message.

Accessors

  • $msg->core_hours() / $msg->core_hours($value)

    Type: Double

    The CPU core hours the task consumes based on task requirement and run time.

Google::Cloud::Batch::V1alpha::Task::Runnable

Runnable describes instructions for executing a specific script or container as part of a Task.

Inherits from Protobuf::Message.

Accessors

  • $msg->container() / $msg->container($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Runnable::Container)

    Container runnable.

  • $msg->script() / $msg->script($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Runnable::Script)

    Script runnable.

  • $msg->barrier() / $msg->barrier($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Runnable::Barrier)

    Barrier runnable.

  • $msg->display_name() / $msg->display_name($value)

    Type: String

    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.

  • $msg->ignore_exit_status() / $msg->ignore_exit_status($value)

    Type: Bool

    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.

  • $msg->background() / $msg->background($value)

    Type: Bool

    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.

  • $msg->always_run() / $msg->always_run($value)

    Type: Bool

    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.

  • $msg->environment() / $msg->environment($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Environment)

    Environment variables for this Runnable (overrides variables set for the whole Task or TaskGroup).

  • $msg->timeout() / $msg->timeout($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Timeout for this Runnable.

  • $msg->labels() / $msg->labels($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Runnable::LabelsEntry)

    Labels for this Runnable.

Google::Cloud::Batch::V1alpha::Task::TaskSpec

Spec of a task

Inherits from Protobuf::Message.

Accessors

  • $msg->runnables() / $msg->runnables($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Runnable)

    Required. The sequence of one or more runnables (executable scripts, executable containers, and/or barriers) for each task in this task group to run. Each task runs this list of runnables in order. For a task to succeed, all of its script and container runnables each must meet at least one of the following conditions:

    + The runnable exited with a zero status. + The runnable didn't finish, but you enabled its `background` subfield. + The runnable exited with a non-zero status, but you enabled its `ignore_exit_status` subfield.

  • $msg->compute_resource() / $msg->compute_resource($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::ComputeResource)

    ComputeResource requirements.

  • $msg->max_run_duration() / $msg->max_run_duration($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Maximum duration the task should run before being automatically retried (if enabled) or automatically failed. Format the value of this field as a time limit in seconds followed by `s`—for example, `3600s` for 1 hour. The field accepts any value between 0 and the maximum listed for the `Duration` field type at https://protobuf.dev/reference/protobuf/google.protobuf/#duration; however, the actual maximum run time for a job will be limited to the maximum run time for a job listed at https://cloud.google.com/batch/quotas#max-job-duration.

  • $msg->max_retry_count() / $msg->max_retry_count($value)

    Type: Int32

    Maximum number of retries on failures. The default, 0, which means never retry. The valid value range is [0, 10].

  • $msg->lifecycle_policies() / $msg->lifecycle_policies($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::LifecyclePolicy)

    Lifecycle management schema when any task in a task group is failed. Currently we only support one lifecycle policy. When the lifecycle policy condition is met, the action in the policy will execute. If task execution result does not meet with the defined lifecycle policy, we consider it as the default policy. Default policy means if the exit code is 0, exit task. If task ends with non-zero exit code, retry the task with max_retry_count.

  • $msg->environments() / $msg->environments($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::TaskSpec::EnvironmentsEntry)

    Deprecated: please use environment(non-plural) instead.

  • $msg->volumes() / $msg->volumes($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Volume::Volume)

    Volumes to mount before running Tasks using this TaskSpec.

  • $msg->environment() / $msg->environment($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::Environment)

    Environment variables to set before running the Task.

Google::Cloud::Batch::V1alpha::Task::LifecyclePolicy

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

Inherits from Protobuf::Message.

Accessors

  • $msg->action() / $msg->action($value)

    Type: Enum (Google::Cloud::Batch::V1alpha::LifecyclePolicy::Action)

    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.

  • $msg->action_condition() / $msg->action_condition($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::LifecyclePolicy::ActionCondition)

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

Enum: LifecyclePolicy::Action

  • ACTION_UNSPECIFIED => 0

  • RETRY_TASK => 1

  • FAIL_TASK => 2

Google::Cloud::Batch::V1alpha::Task::Task

A Cloud Batch task.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    Task name. The name is generated from the parent TaskGroup name and 'id' field. For example: "projects/123456/locations/us-west1/jobs/job01/taskGroups/group01/tasks/task01".

  • $msg->status() / $msg->status($value)

    Type: Message (Google::Cloud::Batch::V1alpha::Task::TaskStatus)

    Task Status.

Google::Cloud::Batch::V1alpha::Task::Environment

An Environment describes a collection of environment variables to set when executing Tasks.

Inherits from Protobuf::Message.

Accessors

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Batch::V1alpha::Task::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.