Workflows
Control Flow
Branching - Parallel

Parallel

Overview

Parallel is multi-path branching operator. It allows you to create multiple execution branches with optional filtering rules and Pipedream will execute all matching branches. Unlike Switch and If/Else, the order in which rules are defined will not affect the path of execution.

Parallel

Capabilities

  • Create non-linear workflows that execute steps in parallel branches
  • Define when branches run — always, conditionally or never (to disable a branch)
  • Merge and continue execution in the parent flow after the branching operation

The Parallel operator is a control flow Block with start and end phases. Learn more about Blocks.

Add Parallel operator to workflow

Select Parallel from the Control Flow section of the step selector:

add parallel block

Create Branches

To create new branches, click the + button:

add branch

Rename Branches

Edit the branch's nameslug on the canvas or in the right pane after selecting the Start phase of the parallel block. The nameslug communicates the branch's purpose and affects workflow execution—the end phase exports an object, with each key corresponding to a branch name.

rename branch

Export Data to the Parent Flow

You can export data from a parallel operation and continue execution in the parent flow.

  • The parallel block exports data as a JSON object
  • Branch exports are assigned to a key corresponding to the branch name slug (in the object exported from the block)
  • Only the exports from the last step of each executed branch are included in the parallel block's return value
  • To preview the exported data, test the End phase of the parallel block

Beta Limitations

Workflow queue settings (concurrency, execution rate) may not work as expected with workflows using the parallel operator.

Getting Started

Generate a test event

Add a trigger and generate an event to help you build and test your workflow:

trigger.gif

Add the Parallel control flow block

Click the + button to add a step to the canvas and select Parallel from the Control Flow section on the right. You can optionally add or remove branches and configure conditions defining when each branch should run.

add parallel.gif

Test to identify the execution path(s)

Test the Start phase to identify which branches will execute for the current event.

configure and test.gif

Add steps to branches

Add steps to the branches. These steps will be executed in parallel when the workflow runs.

add steps.gif

Optionally merge and continue to the parent flow

Test the End phase to export the results of the last step of each branch that was executed. This makes data from the branches available to reference in the parent flow.

export_data_to_parent

Use exports in parent flow

Optionally add steps after the parallel block and use data from individual branches by referencing the return value of the End phase.

use exports in parent flow

Deploy and test the live workflow

Deploy the workflow and trigger it to inspect the executions.

Inspect