The Workflows
experimental function,
experimental.executions.map, starts a workflow execution for each
corresponding argument, and waits for all of the executions to finish, returning
a list where each element is the result of an execution.
If you are using experimental.executions.map to support parallel work, you can
migrate your workflow to use parallel steps instead, executing ordinary
for loops in parallel.
A parallel step defines a part of your workflow where two or more steps can
execute concurrently. A parallel step waits until all the steps defined within
it have completed or are interrupted by an unhandled exception; execution then
continues. Like
experimental.executions.map, the execution order is not guaranteed. For
details, see the syntax reference page for
parallel steps.
Note that the use of experimental.executions.map or workflows.executions.run
requires additional concurrent executions quota.
However, when using parallel steps with calls to connectors
inlined (see the translation connector example), no
additional execution quota is required.
The following examples are intended to assist you when replacing the use of
experimental.executions.map with a parallel step.
Translation workflow
Given a source and target language, the following workflow, named translate,
uses the
Cloud Translation connector
to translate some input text and return the result. Note that the Cloud Translation API
must be enabled.
YAML
main: params: [args] steps: - basic_translate: call: googleapis.translate.v2.translations.translate args: body: q: ${args.text} target: ${args.target} format: "text" source: ${args.source} result: r - return_step: return: ${r}
JSON
{ "main": { "params":