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.
This method waits—the workflow execution is paused—until the operation is
complete, fails, or times out. The default timeout value is 1800
seconds (30
minutes) and can be changed to a maximum value of 31536000
seconds (one year)
for long-running operations using the connector_params
field.
The connector uses polling to monitor the long-running operation, which might
generate additional billable steps. The polling policy for the long-running
operation can be configured. For example, if you set skip_polling
to True
,
the connector invocation call is non-blocking if the initial request succeeds;
otherwise, retries might occur.
For more information about connector-specific parameters (connector_params
),
see Invoke a connector call.
For more information about retries and long-running operations, see Understand connectors.
Note that if skip_polling
is set to True
, run()
doesn't return anything
unlike the create()
method which returns a response containing an instance of
Execution
. Otherwise, run()
returns the workflow execution's result as a
JSON-decoded object.
Arguments
Parameters | |
---|---|
workflow_id |
Required. ID of the workflow. |
location |
Optional location of the workflow. If not present, the location of the current project is used by default. |
project_id |
Optional project ID associated with the workflow. If not present, the current project ID is used by default. |
argument |
Optional execution parameters defined in YAML source code. Supported types include integer, float, bool, string, list, or map. |
Raised exceptions
Exceptions | |
---|---|
ConnectionError |
In case of a network problem (such as DNS failure or refused connection). |
HttpError |
If the response status is >= 400 (excluding 429 and 503). |
TimeoutError |
If a long-running operation takes longer to finish than the specified timeout limit. |
TypeError |
If an operation or function receives an argument of the wrong type. |
ValueError |
If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout. |
OperationError |
If a long-running operation finished unsuccessfully. |
ResponseTypeError |
If the long-running operation returned a response of the wrong type. |
Response
The workflow execution's result.
Subworkflow snippet
Some fields might be optional or required.
YAML
- run: call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run args: workflow_id: ... location: ... project_id: ... argument: ... result: runResult
JSON
[ { "run": { "call": "googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run", "args": { "workflow_id": "...", "location": "...", "project_id": "...", "argument": "..." }, "result": "runResult" } } ]