Package com.google.cloud.batch.v1 (0.8.0)

A client to Batch API

The interfaces provided are listed below, along with usage samples.

BatchServiceClient

Service Description: Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

Sample for BatchServiceClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Job job = Job.newBuilder().build();
   String jobId = "jobId101296568";
   Job response = batchServiceClient.createJob(parent, job, jobId);
 }
 

Classes

AllocationPolicy

A Job's resource allocation policy describes when, where, and how compute resources should be allocated for the Job.

Protobuf type google.cloud.batch.v1.AllocationPolicy

AllocationPolicy.Accelerator

Accelerator describes Compute Engine accelerators to be attached to the VM.

Protobuf type google.cloud.batch.v1.AllocationPolicy.Accelerator

AllocationPolicy.Accelerator.Builder

Accelerator describes Compute Engine accelerators to be attached to the VM.

Protobuf type google.cloud.batch.v1.AllocationPolicy.Accelerator

AllocationPolicy.AttachedDisk

A new or an existing persistent disk (PD) or a local ssd attached to a VM instance.

Protobuf type google.cloud.batch.v1.AllocationPolicy.AttachedDisk

AllocationPolicy.AttachedDisk.Builder

A new or an existing persistent disk (PD) or a local ssd attached to a VM instance.

Protobuf type google.cloud.batch.v1.AllocationPolicy.AttachedDisk

AllocationPolicy.Builder

A Job's resource allocation policy describes when, where, and how compute resources should be allocated for the Job.

Protobuf type google.cloud.batch.v1.AllocationPolicy

AllocationPolicy.Disk

A new persistent disk or a local ssd. A VM can only have one local SSD setting but multiple local SSD partitions. https://cloud.google.com/compute/docs/disks#pdspecs. https://cloud.google.com/compute/docs/disks#localssds.

Protobuf type google.cloud.batch.v1.AllocationPolicy.Disk

AllocationPolicy.Disk.Builder

A new persistent disk or a local ssd. A VM can only have one local SSD setting but multiple local SSD partitions. https://cloud.google.com/compute/docs/disks#pdspecs. https://cloud.google.com/compute/docs/disks#localssds.

Protobuf type google.cloud.batch.v1.AllocationPolicy.Disk

AllocationPolicy.InstancePolicy

InstancePolicy describes an instance type and resources attached to each VM created by this InstancePolicy.

Protobuf type google.cloud.batch.v1.AllocationPolicy.InstancePolicy

AllocationPolicy.InstancePolicy.Builder

InstancePolicy describes an instance type and resources attached to each VM created by this InstancePolicy.

Protobuf type google.cloud.batch.v1.AllocationPolicy.InstancePolicy

AllocationPolicy.InstancePolicyOrTemplate

Either an InstancePolicy or an instance template.

Protobuf type google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate

AllocationPolicy.InstancePolicyOrTemplate.Builder

Either an InstancePolicy or an instance template.

Protobuf type google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate

AllocationPolicy.LocationPolicy

Protobuf type google.cloud.batch.v1.AllocationPolicy.LocationPolicy

AllocationPolicy.LocationPolicy.Builder

Protobuf type google.cloud.batch.v1.AllocationPolicy.LocationPolicy

AllocationPolicy.NetworkInterface

A network interface.

Protobuf type google.cloud.batch.v1.AllocationPolicy.NetworkInterface

AllocationPolicy.NetworkInterface.Builder

A network interface.

Protobuf type google.cloud.batch.v1.AllocationPolicy.NetworkInterface

AllocationPolicy.NetworkPolicy

NetworkPolicy describes VM instance network configurations.

Protobuf type google.cloud.batch.v1.AllocationPolicy.NetworkPolicy

AllocationPolicy.NetworkPolicy.Builder

NetworkPolicy describes VM instance network configurations.

Protobuf type google.cloud.batch.v1.AllocationPolicy.NetworkPolicy

BatchProto

BatchServiceClient

Service Description: Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Job job = Job.newBuilder().build();
   String jobId = "jobId101296568";
   Job response = batchServiceClient.createJob(parent, job, jobId);
 }
 

Note: close() needs to be called on the BatchServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of BatchServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 BatchServiceSettings batchServiceSettings =
     BatchServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 BatchServiceSettings batchServiceSettings =
     BatchServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 BatchServiceSettings batchServiceSettings = BatchServiceSettings.newHttpJsonBuilder().build();
 BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

BatchServiceClient.ListJobsFixedSizeCollection

BatchServiceClient.ListJobsPage

BatchServiceClient.ListJobsPagedResponse

BatchServiceClient.ListLocationsFixedSizeCollection

BatchServiceClient.ListLocationsPage

BatchServiceClient.ListLocationsPagedResponse

BatchServiceClient.ListTasksFixedSizeCollection

BatchServiceClient.ListTasksPage

BatchServiceClient.ListTasksPagedResponse

BatchServiceGrpc

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

BatchServiceGrpc.BatchServiceBlockingStub

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

BatchServiceGrpc.BatchServiceFutureStub

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

BatchServiceGrpc.BatchServiceImplBase

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

BatchServiceGrpc.BatchServiceStub

Google Batch Service. The service manages user submitted batch jobs and allocates Google Compute Engine VM instances to run the jobs.

BatchServiceSettings

Settings class to configure an instance of BatchServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (batch.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of createJob to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 BatchServiceSettings.Builder batchServiceSettingsBuilder = BatchServiceSettings.newBuilder();
 batchServiceSettingsBuilder
     .createJobSettings()
     .setRetrySettings(
         batchServiceSettingsBuilder
             .createJobSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 BatchServiceSettings batchServiceSettings = batchServiceSettingsBuilder.build();
 

BatchServiceSettings.Builder

Builder for BatchServiceSettings.

ComputeResource

Compute resource requirements

Protobuf type google.cloud.batch.v1.ComputeResource

ComputeResource.Builder

Compute resource requirements

Protobuf type google.cloud.batch.v1.ComputeResource

CreateJobRequest

CreateJob Request.

Protobuf type google.cloud.batch.v1.CreateJobRequest

CreateJobRequest.Builder

CreateJob Request.

Protobuf type google.cloud.batch.v1.CreateJobRequest

DeleteJobRequest

DeleteJob Request.

Protobuf type google.cloud.batch.v1.DeleteJobRequest

DeleteJobRequest.Builder

DeleteJob Request.

Protobuf type google.cloud.batch.v1.DeleteJobRequest

Environment

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

Protobuf type google.cloud.batch.v1.Environment

Environment.Builder

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

Protobuf type google.cloud.batch.v1.Environment

Environment.KMSEnvMap

Protobuf type google.cloud.batch.v1.Environment.KMSEnvMap

Environment.KMSEnvMap.Builder

Protobuf type google.cloud.batch.v1.Environment.KMSEnvMap

GCS

Represents a Google Cloud Storage volume.

Protobuf type google.cloud.batch.v1.GCS

GCS.Builder

Represents a Google Cloud Storage volume.

Protobuf type google.cloud.batch.v1.GCS

GetJobRequest

GetJob Request.

Protobuf type google.cloud.batch.v1.GetJobRequest

GetJobRequest.Builder

GetJob Request.

Protobuf type google.cloud.batch.v1.GetJobRequest

GetTaskRequest

Request for a single Task by name.

Protobuf type google.cloud.batch.v1.GetTaskRequest

GetTaskRequest.Builder

Request for a single Task by name.

Protobuf type google.cloud.batch.v1.GetTaskRequest

Job

The Cloud Batch Job description.

Protobuf type google.cloud.batch.v1.Job

Job.Builder

The Cloud Batch Job description.

Protobuf type google.cloud.batch.v1.Job

JobName

JobName.Builder

Builder for projects/{project}/locations/{location}/jobs/{job}.

JobNotification

Notification configurations.

Protobuf type google.cloud.batch.v1.JobNotification

JobNotification.Builder

Notification configurations.

Protobuf type google.cloud.batch.v1.JobNotification

JobNotification.Message

Message details. Describe the attribute that a message should have. Without specified message attributes, no message will be sent by default.

Protobuf type google.cloud.batch.v1.JobNotification.Message

JobNotification.Message.Builder

Message details. Describe the attribute that a message should have. Without specified message attributes, no message will be sent by default.

Protobuf type google.cloud.batch.v1.JobNotification.Message

JobProto

JobStatus

Job status.

Protobuf type google.cloud.batch.v1.JobStatus

JobStatus.Builder

Job status.

Protobuf type google.cloud.batch.v1.JobStatus

JobStatus.InstanceStatus

VM instance status.

Protobuf type google.cloud.batch.v1.JobStatus.InstanceStatus

JobStatus.InstanceStatus.Builder

VM instance status.

Protobuf type google.cloud.batch.v1.JobStatus.InstanceStatus

JobStatus.TaskGroupStatus

Aggregated task status for a TaskGroup.

Protobuf type google.cloud.batch.v1.JobStatus.TaskGroupStatus

JobStatus.TaskGroupStatus.Builder

Aggregated task status for a TaskGroup.

Protobuf type google.cloud.batch.v1.JobStatus.TaskGroupStatus

LifecyclePolicy

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

Protobuf type google.cloud.batch.v1.LifecyclePolicy

LifecyclePolicy.ActionCondition

Conditions for actions to deal with task failures.

Protobuf type google.cloud.batch.v1.LifecyclePolicy.ActionCondition

LifecyclePolicy.ActionCondition.Builder

Conditions for actions to deal with task failures.

Protobuf type google.cloud.batch.v1.LifecyclePolicy.ActionCondition

LifecyclePolicy.Builder

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

Protobuf type google.cloud.batch.v1.LifecyclePolicy

ListJobsRequest

ListJob Request.

Protobuf type google.cloud.batch.v1.ListJobsRequest

ListJobsRequest.Builder

ListJob Request.

Protobuf type google.cloud.batch.v1.ListJobsRequest

ListJobsResponse

ListJob Response.

Protobuf type google.cloud.batch.v1.ListJobsResponse

ListJobsResponse.Builder

ListJob Response.

Protobuf type google.cloud.batch.v1.ListJobsResponse

ListTasksRequest

ListTasks Request.

Protobuf type google.cloud.batch.v1.ListTasksRequest

ListTasksRequest.Builder

ListTasks Request.

Protobuf type google.cloud.batch.v1.ListTasksRequest

ListTasksResponse

ListTasks Response.

Protobuf type google.cloud.batch.v1.ListTasksResponse

ListTasksResponse.Builder

ListTasks Response.

Protobuf type google.cloud.batch.v1.ListTasksResponse

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

LogsPolicy

LogsPolicy describes how outputs from a Job's Tasks (stdout/stderr) will be preserved.

Protobuf type google.cloud.batch.v1.LogsPolicy

LogsPolicy.Builder

LogsPolicy describes how outputs from a Job's Tasks (stdout/stderr) will be preserved.

Protobuf type google.cloud.batch.v1.LogsPolicy

NFS

Represents an NFS volume.

Protobuf type google.cloud.batch.v1.NFS

NFS.Builder

Represents an NFS volume.

Protobuf type google.cloud.batch.v1.NFS

OperationMetadata

Represents the metadata of the long-running operation.

Protobuf type google.cloud.batch.v1.OperationMetadata

OperationMetadata.Builder

Represents the metadata of the long-running operation.

Protobuf type google.cloud.batch.v1.OperationMetadata

Runnable

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

Protobuf type google.cloud.batch.v1.Runnable

Runnable.Barrier

Barrier runnable blocks until all tasks in a taskgroup reach it.

Protobuf type google.cloud.batch.v1.Runnable.Barrier

Runnable.Barrier.Builder

Barrier runnable blocks until all tasks in a taskgroup reach it.

Protobuf type google.cloud.batch.v1.Runnable.Barrier

Runnable.Builder

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

Protobuf type google.cloud.batch.v1.Runnable

Runnable.Container

Container runnable.

Protobuf type google.cloud.batch.v1.Runnable.Container

Runnable.Container.Builder

Container runnable.

Protobuf type google.cloud.batch.v1.Runnable.Container

Runnable.Script

Script runnable.

Protobuf type google.cloud.batch.v1.Runnable.Script

Runnable.Script.Builder

Script runnable.

Protobuf type google.cloud.batch.v1.Runnable.Script

ServiceAccount

Carries information about a Google Cloud service account.

Protobuf type google.cloud.batch.v1.ServiceAccount

ServiceAccount.Builder

Carries information about a Google Cloud service account.

Protobuf type google.cloud.batch.v1.ServiceAccount

StatusEvent

Status event

Protobuf type google.cloud.batch.v1.StatusEvent

StatusEvent.Builder

Status event

Protobuf type google.cloud.batch.v1.StatusEvent

Task

A Cloud Batch task.

Protobuf type google.cloud.batch.v1.Task

Task.Builder

A Cloud Batch task.

Protobuf type google.cloud.batch.v1.Task

TaskExecution

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

Protobuf type google.cloud.batch.v1.TaskExecution

TaskExecution.Builder

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

Protobuf type google.cloud.batch.v1.TaskExecution

TaskGroup

A TaskGroup contains one or multiple Tasks that share the same Runnable but with different runtime parameters.

Protobuf type google.cloud.batch.v1.TaskGroup

TaskGroup.Builder

A TaskGroup contains one or multiple Tasks that share the same Runnable but with different runtime parameters.

Protobuf type google.cloud.batch.v1.TaskGroup

TaskGroupName

TaskGroupName.Builder

Builder for projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}.

TaskName

TaskName.Builder

Builder for projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}/tasks/{task}.

TaskProto

TaskSpec

Spec of a task

Protobuf type google.cloud.batch.v1.TaskSpec

TaskSpec.Builder

Spec of a task

Protobuf type google.cloud.batch.v1.TaskSpec

TaskStatus

Status of a task

Protobuf type google.cloud.batch.v1.TaskStatus

TaskStatus.Builder

Status of a task

Protobuf type google.cloud.batch.v1.TaskStatus

Volume

Volume describes a volume and parameters for it to be mounted to a VM.

Protobuf type google.cloud.batch.v1.Volume

Volume.Builder

Volume describes a volume and parameters for it to be mounted to a VM.

Protobuf type google.cloud.batch.v1.Volume

VolumeProto

Interfaces

AllocationPolicy.AcceleratorOrBuilder

AllocationPolicy.AttachedDiskOrBuilder

AllocationPolicy.DiskOrBuilder

AllocationPolicy.InstancePolicyOrBuilder

AllocationPolicy.InstancePolicyOrTemplateOrBuilder

AllocationPolicy.LocationPolicyOrBuilder

AllocationPolicy.NetworkInterfaceOrBuilder

AllocationPolicy.NetworkPolicyOrBuilder

AllocationPolicyOrBuilder

ComputeResourceOrBuilder

CreateJobRequestOrBuilder

DeleteJobRequestOrBuilder

Environment.KMSEnvMapOrBuilder

EnvironmentOrBuilder

GCSOrBuilder

GetJobRequestOrBuilder

GetTaskRequestOrBuilder

JobNotification.MessageOrBuilder

JobNotificationOrBuilder

JobOrBuilder

JobStatus.InstanceStatusOrBuilder

JobStatus.TaskGroupStatusOrBuilder

JobStatusOrBuilder

LifecyclePolicy.ActionConditionOrBuilder

LifecyclePolicyOrBuilder

ListJobsRequestOrBuilder

ListJobsResponseOrBuilder

ListTasksRequestOrBuilder

ListTasksResponseOrBuilder

LogsPolicyOrBuilder

NFSOrBuilder

OperationMetadataOrBuilder

Runnable.BarrierOrBuilder

Runnable.ContainerOrBuilder

Runnable.ScriptOrBuilder

RunnableOrBuilder

ServiceAccountOrBuilder

StatusEventOrBuilder

TaskExecutionOrBuilder

TaskGroupOrBuilder

TaskOrBuilder

TaskSpecOrBuilder

TaskStatusOrBuilder

VolumeOrBuilder

Enums

AllocationPolicy.AttachedDisk.AttachedCase

AllocationPolicy.Disk.DataSourceCase

AllocationPolicy.InstancePolicyOrTemplate.PolicyTemplateCase

AllocationPolicy.ProvisioningModel

Compute Engine VM instance provisioning model.

Protobuf enum google.cloud.batch.v1.AllocationPolicy.ProvisioningModel

JobNotification.Type

The message type.

Protobuf enum google.cloud.batch.v1.JobNotification.Type

JobStatus.State

Valid Job states.

Protobuf enum google.cloud.batch.v1.JobStatus.State

LifecyclePolicy.Action

Action on task failures based on different conditions.

Protobuf enum google.cloud.batch.v1.LifecyclePolicy.Action

LogsPolicy.Destination

The destination (if any) for logs.

Protobuf enum google.cloud.batch.v1.LogsPolicy.Destination

Runnable.ExecutableCase

Runnable.Script.CommandCase

TaskStatus.State

Task states.

Protobuf enum google.cloud.batch.v1.TaskStatus.State

Volume.SourceCase