Workflow Executions API Connector Overview

The Workflows connector defines the built-in functions that can be used to access other Google Cloud products within a workflow.

This page provides an overview of the individual connector. There is no need to import or load connector libraries in a workflow—connectors work out of the box when used in a call step.

Workflow Executions API

Execute workflows created with Workflows API. To learn more, see the Workflow Executions API documentation.

Helper Method

You can use the helper method run to launch a workflow execution. This is simpler than using the create API as it doesn't require workflow arguments in a JSON string format. To learn more, see the run documentation.

Workflow Executions connector sample

YAML

# This workflow demonstrates how to use the Cloud Workflow Executions connector
# to create an execution for a workflow. Make sure the workflow
# already exists in your project.
# Expected successful output: "SUCCESS"

- init:
    assign:
      - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
      - location: "us-central1"
      - workflow: "[fill in the workflow to execute]"  # Make sure this workflow exists in your project.
      - arguments:
          hello: world
          integer: 100
          boolean: true
# The run helper method is the preferred way to execute a workflow as it doesn't require
# encoding the workflow arguments in a JSON-formatted string. To compare
# the usage, we list two demo steps:
- run_execution:
    call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run
    args:
      workflow_id: ${workflow}
      location: ${location}
      project_id: ${project}
      argument: ${arguments}  # Arguments could be specified inline as a map instead.
    result: r1
- create_execution:
    call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.create
    args:
      parent: ${"projects/" + project + "/locations/" + location + "/workflows/" + workflow}
      body:
        argument: ${json.encode_to_string(arguments)}
    result: r2
- the_end:
    return:
      - ${r1}
      - ${r2}

JSON

[
  {
    "init": {
      "assign": [
        {
          "project": "${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}"
        },
        {
          "location": "us-central1"
        },
        {
          "workflow": "[fill in the workflow to execute]"
        },
        {
          "arguments": {
            "hello": "world",
            "integer": 100,
            "boolean": true
          }
        }
      ]
    }
  },
  {
    "run_execution": {
      "call": "googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run",
      "args": {
        "workflow_id": "${workflow}",
        "location": "${location}",
        "project_id": "${project}",
        "argument": "${arguments}"
      },
      "result": "r1"
    }
  },
  {
    "create_execution": {
      "call": "googleapis.workflowexecutions.v1.projects.locations.workflows.executions.create",
      "args": {
        "parent": "${\"projects/\" + project + \"/locations/\" + location + \"/workflows/\" + workflow}",
        "body": {
          "argument": "${json.encode_to_string(arguments)}"
        }
      },
      "result": "r2"
    }
  },
  {
    "the_end": {
      "return": [
        "${r1}",
        "${r2}"
      ]
    }
  }
]

Module: googleapis.workflowexecutions.v1.projects.locations.workflows

Functions
triggerPubsubExecution Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.

Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions

Functions
cancel Cancels an execution of the given name.
create Creates a new execution using the latest revision of the given workflow. Input parameters must be represented as a JSON string.
deleteExecutionHistory Deletes all step entries for an execution.
exportData Returns all metadata stored about an execution, excluding most data that is already accessible using other API methods.
get Returns an execution of the given name.
list Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).
run Starts a workflow execution and waits for it to finish. This provides a simpler interface to launch a workflow execution than the create() method. Note that run() calls create() to start a new execution, and optionally accepts execution parameters defined in the YAML source code as either integer, float, bool, string, list, or map data types.

Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.callbacks

Functions
list Returns a list of active callbacks that belong to the execution with the given name. The returned callbacks are ordered by callback ID.

Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.stepEntries

Functions
get Gets a step entry.
list Lists step entries for the corresponding workflow execution. Returned entries are ordered by their create_time.

Module: googleapis.workflowexecutions.v1beta.projects.locations.workflows.executions

Functions
cancel Cancels an execution of the given name.
create Creates a new execution using the latest revision of the given workflow.
get Returns an execution of the given name.
list Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).
run Starts a workflow execution and waits for it to finish. This provides a simpler interface to launch a workflow execution than the create() method. Note that run() calls create() to start a new execution, and optionally accepts execution parameters defined in the YAML source code as either integer, float, bool, string, list, or map data types.