# Workflow Executions API . projects . locations . workflows

## Instance Methods

Returns the executions Resource.

Close httplib2 connections.

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

### Method Details

`close()`

    Close httplib2 connections.

`triggerPubsubExecution(workflow, body=None, x__xgafv=None)`

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

    Args:
      workflow: string, Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow} (required)
      body: object, The request body.
        The object takes the form of:

    { # Request for the TriggerPubsubExecution method.
      "GCPCloudEventsMode": "A String", # Required. LINT: LEGACY_NAMES The query parameter value for __GCP_CloudEventsMode, set by the Eventarc service when configuring triggers.
      "deliveryAttempt": 42, # The number of attempts that have been made to deliver this message. This is set by Pub/Sub for subscriptions that have the "dead letter" feature enabled, and hence provided here for compatibility, but is ignored by Workflows.
      "message": { # A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits. # Required. The message of the Pub/Sub push notification.
        "attributes": { # Optional. Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.
          "a_key": "A String",
        },
        "data": "A String", # Optional. The message data field. If this field is empty, the message must contain at least one attribute.
        "messageId": "A String", # ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.
        "orderingKey": "A String", # Optional. If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
        "publishTime": "A String", # The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.
      },
      "subscription": "A String", # Required. The subscription of the Pub/Sub push notification. Format: projects/{project}/subscriptions/{sub}
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A running instance of a [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
      "argument": "A String", # Input parameters of the execution represented as a JSON string. The size limit is 32KB. *Note*: If you are using the REST API directly to run your workflow, you must escape any JSON string value of `argument`. Example: `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
      "callLogLevel": "A String", # The call logging level associated to this execution.
      "createTime": "A String", # Output only. Marks the creation of the execution.
      "disableConcurrencyQuotaOverflowBuffering": True or False, # Optional. If set to true, the execution will not be backlogged when the concurrency quota is exhausted. The backlog execution starts when the concurrency quota becomes available.
      "duration": "A String", # Output only. Measures the duration of the execution.
      "endTime": "A String", # Output only. Marks the end of execution, successful or not.
      "error": { # Error describes why the execution was abnormally terminated. # Output only. The error which caused the execution to finish prematurely. The value is only present if the execution's state is `FAILED` or `CANCELLED`.
        "context": "A String", # Human-readable stack trace string.
        "payload": "A String", # Error message and data returned represented as a JSON string.
        "stackTrace": { # A collection of stack elements (frames) where an error occurred. # Stack trace with detailed information of where error was generated.
          "elements": [ # An array of stack elements.
            { # A single stack element (frame) where an error occurred.
              "position": { # Position contains source position information about the stack trace element such as line number, column number and length of the code block in bytes. # The source position information of the stack trace element.
                "column": "A String", # The source code column position (of the line) the current instruction was generated from.
                "length": "A String", # The number of bytes of source code making up this stack trace element.
                "line": "A String", # The source code line number the current instruction was generated from.
              },
              "routine": "A String", # The routine where the error occurred.
              "step": "A String", # The step the error occurred at.
            },
          ],
        },
      },
      "executionHistoryLevel": "A String", # Optional. Describes the execution history level to apply to this execution. If not specified, the execution history level is determined by its workflow's execution history level. If the levels are different, the executionHistoryLevel overrides the workflow's execution history level for this execution.
      "labels": { # Labels associated with this execution. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and can only contain lowercase letters, numeric characters, underscores, and dashes. Label keys must start with a letter. International characters are allowed. By default, labels are inherited from the workflow but are overridden by any labels associated with the execution.
        "a_key": "A String",
      },
      "name": "A String", # Output only. The resource name of the execution. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
      "result": "A String", # Output only. Output of the execution represented as a JSON string. The value can only be present if the execution's state is `SUCCEEDED`.
      "startTime": "A String", # Output only. Marks the beginning of execution. Note that this will be the same as `createTime` for executions that start immediately.
      "state": "A String", # Output only. Current state of the execution.
      "stateError": { # Describes an error related to the current state of the Execution resource. # Output only. Error regarding the state of the Execution resource. For example, this field will have error details if the execution data is unavailable due to revoked KMS key permissions.
        "details": "A String", # Provides specifics about the error.
        "type": "A String", # The type of this state error.
      },
      "status": { # Represents the current status of this execution. # Output only. Status tracks the current steps and progress data of this execution.
        "currentSteps": [ # A list of currently executing or last executed step names for the workflow execution currently running. If the workflow has succeeded or failed, this is the last attempted or executed step. Presently, if the current step is inside a subworkflow, the list only includes that step. In the future, the list will contain items for each step in the call stack, starting with the outermost step in the `main` subworkflow, and ending with the most deeply nested step.
          { # Represents a step of the workflow this execution is running.
            "routine": "A String", # Name of a routine within the workflow.
            "step": "A String", # Name of a step within the routine.
          },
        ],
      },
      "workflowRevisionId": "A String", # Output only. Revision of the workflow this execution is using.
    }