Parallel For Loops - FlowWright Workflows Gets More Dynamic

Learn how to use Parallel For Loops to make FlowWright Workflows more dynamic and efficient.

Last published at: April 18th, 2024

FlowWright was one of the initial business process management platforms to offer dynamic sub-workflow, where the workflow morphs and expands at runtime based on runtime information. Most traditional workflow products can only execute based on configuration information. Dynamic sub-workflow was able to solve many problems/scenarios for our customers.

In FlowWright, we have taken dynamic workflow to the next level by offering it within the same workflow. So, what is a "ParallelFor"?  “ParallelFor” is mostly a technical term and is offered by most modern programming languages to iterate over lists using parallel execution paths or parallel threads/cores. From a hardware perspective, a normal looping construct may use a single CPU Core to iteration through sequentially, but a “ParallelFor” loop will use all the CPU Cores to process each of the iterations of the loop.

So how does Parallel For function within FlowWright? Just use the new steps “ParallelFor” and “ParallelForEnd” steps within your workflow.  Below is a simple workflow that uses the “Decision” step between the Parallel steps:

FlowWright Parallel For steps

 

And the Parallel for step is configured with a comma-delimited list of keys, and a variable that will hold each of the keys for each path.

 

Once a Process Instance is created and executed, at execution time the workflow will morph based on the # of keys provided within the Parallel For step.  In the above case, you will see 3 parallel paths.  Below is the rendered execution:

FlowWright morphed parallel execution paths

 

About the above diagram, the first “Decision” step will get a value of “1” for the variable named “key”, and the second will have a value of “2” and so on. Here’s a more complex example, to demonstrate the complexity we have a task that must be completed first before the workflow will build itself. At the start of the execution, the rendered workflow looks as follows:

In the above Parallel For step, there are 10 keys configured, once the waiting task step is completed, the workflow will morph to have 10 parallel paths within the Parallel For steps.

FlowWright morphed workflow at runtime using Parallel For steps

 

Dynamic workflow can be complex, but applies to many scenarios, especially when the # of keys is not known at configuration level, but only known at runtime. “ParallelFor” steps can be configured at many levels within the same workflow, and the workflow will automatically morph to accommodate multiple parallel paths of processing. With the advancement of technology and algorithms, “ParallelFor” takes FlowWright to the edges of computing regarding workflow.