diff --git a/docs-v2/pages/workflows/control-flow/_meta.json b/docs-v2/pages/workflows/control-flow/_meta.json index cc1e33e9a7133..45e9b74042cd0 100644 --- a/docs-v2/pages/workflows/control-flow/_meta.json +++ b/docs-v2/pages/workflows/control-flow/_meta.json @@ -2,6 +2,7 @@ "index": "Overview", "ifelse": "Branching - If/Else", "switch": "Branching - Switch", + "parallel": "Branching - Parallel", "delay": "Delay", "filter": "Filter", "end-workflow": "End Workflow" diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/01_trigger.gif b/docs-v2/pages/workflows/control-flow/images/parallel/01_trigger.gif new file mode 100644 index 0000000000000..fa5576ba52a19 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/01_trigger.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/02_add_parallel.gif b/docs-v2/pages/workflows/control-flow/images/parallel/02_add_parallel.gif new file mode 100644 index 0000000000000..b12abcb83398d Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/02_add_parallel.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/03_configure_and_test.gif b/docs-v2/pages/workflows/control-flow/images/parallel/03_configure_and_test.gif new file mode 100644 index 0000000000000..001f944b1f0b7 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/03_configure_and_test.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/04_add_steps.gif b/docs-v2/pages/workflows/control-flow/images/parallel/04_add_steps.gif new file mode 100644 index 0000000000000..f48aa1a64f699 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/04_add_steps.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/05_test_end_phase.gif b/docs-v2/pages/workflows/control-flow/images/parallel/05_test_end_phase.gif new file mode 100644 index 0000000000000..263f21125d519 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/05_test_end_phase.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/06_use_exports_in_parent_flow.gif b/docs-v2/pages/workflows/control-flow/images/parallel/06_use_exports_in_parent_flow.gif new file mode 100644 index 0000000000000..e472567b8fd1e Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/06_use_exports_in_parent_flow.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/07_deploy_and_run.gif b/docs-v2/pages/workflows/control-flow/images/parallel/07_deploy_and_run.gif new file mode 100644 index 0000000000000..b0adc1ccc36df Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/07_deploy_and_run.gif differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/add_branch.png b/docs-v2/pages/workflows/control-flow/images/parallel/add_branch.png new file mode 100644 index 0000000000000..d1ddc48472e04 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/add_branch.png differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/add_parallel_block.png b/docs-v2/pages/workflows/control-flow/images/parallel/add_parallel_block.png new file mode 100644 index 0000000000000..0dbe975150717 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/add_parallel_block.png differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/parallel.png b/docs-v2/pages/workflows/control-flow/images/parallel/parallel.png new file mode 100644 index 0000000000000..46520fd497c26 Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/parallel.png differ diff --git a/docs-v2/pages/workflows/control-flow/images/parallel/rename_branch.png b/docs-v2/pages/workflows/control-flow/images/parallel/rename_branch.png new file mode 100644 index 0000000000000..3a9f1c43b718a Binary files /dev/null and b/docs-v2/pages/workflows/control-flow/images/parallel/rename_branch.png differ diff --git a/docs-v2/pages/workflows/control-flow/parallel.mdx b/docs-v2/pages/workflows/control-flow/parallel.mdx new file mode 100644 index 0000000000000..a0b1dee96e25e --- /dev/null +++ b/docs-v2/pages/workflows/control-flow/parallel.mdx @@ -0,0 +1,99 @@ +import Callout from '@/components/Callout' +import VideoPlayer from "@/components/VideoPlayer"; +import { Steps } from 'nextra/components' + +# 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](./switch) and [If/Else](./ifelse), the order in which rules are defined will not affect the path of execution. + +![Parallel](./images/parallel/parallel.png) + +## 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](./#blocks). + + +### Add Parallel operator to workflow + +Select **Parallel** from the **Control Flow** section of the step selector: + +![add parallel block](./images/parallel/add_parallel_block.png) + +### Create Branches + +To create new branches, click the `+` button: + +![add branch](./images/parallel/add_branch.png) + +### 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](./images/parallel/rename_branch.png) + +### 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](./images/parallel/01_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](./images/parallel/02_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](./images/parallel/03_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](./images/parallel/04_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](./images/parallel/05_test_end_phase.gif) + +### 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](./images/parallel/06_use_exports_in_parent_flow.gif) + +### Deploy and test the live workflow + +Deploy the workflow and trigger it to inspect the executions. + +![Inspect](./images/parallel/07_deploy_and_run.gif) + + \ No newline at end of file