Connector for Batch

Workflows connector that defines the built-in function used to access Batch within a workflow.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

# This workflow demonstrates how to use the Batch connector.
# This workflow sends a List request to Batch connector.
main:
  steps:
    - init:
        assign:
          - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          - location: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}
          - jobId: "example-job"
    - create_job:
        call: googleapis.batch.v1.projects.locations.jobs.create
        args:
          parent: ${"projects/" + project + "/locations/" + location}
          jobId: ${jobId}
          body:
            priority: 99
            taskGroups:
              taskSpec:
                runnables:
                  script:
                    text: "echo Hello World!"
                computeResource:
                  cpuMilli: 2000
                  memoryMib: 16
              taskCount: 1
    - delete_job:
        call: googleapis.batch.v1.projects.locations.jobs.delete
        args:
          name: ${"projects/" + project + "/locations/" + location + "/jobs/" + jobId}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.