Workspace 7.0.2
Running workflows in parallel on a local machine

Introduction

Workspace can be used to parallelise and distribute aspects of a workflow. In this tutorial we will cover the following:

  • Understand how to enable and configure a workflow for parallel execution
  • Understand how to control features of parallel execution
Note
Just in case you get stuck, this sample workflow has been provided for you.

Contents


Configuring a workflow for parallel execution

  1. Open the workspace editor.
  2. In the Operation catalogue, locate the "Parallel loop" nested workflow (located under "Parallel") and drag this sample workflow onto your workspace canvas.
    The Parallel loop workflow
  3. Select the "Parallel loop" nested workflow you have added and right click on the workflow's dependencies output and choose the "Create workspace output" menu item.
    The Parallel loop workflow connected to an output
  4. Next, double click on the "Parallel loop" workflow you have added onto your canvas. You should be able to see that the parallel loop is in fact a pre-built workflow that contains a ForLoop. The for loop body simply prints the loop's counter value to the workspace Log window pausing several seconds between each iteration (to simulate a lengthy operation).
  5. Select the "For Loop" operation in your workflow to the Operation's inputs.
    The Parallel loop workflow's IO Tree Widget
  6. You should be able to see that, by default, our loop is configured to execute 10 iterations. You should also see that the loop is configured to run in parallel as indicated by the "Enable parallel looping" option.
  7. Before running the workflow let's tick the "Wrap" option of the selected ForLoop. This will run our loop indefinitely (i.e. until we stop execution) by wrapping around to the start value once the end value has been reached.
  8. Run the workflow. Notice that the workflow is running and the executed iteration's counter value is printed to the log window with a pause between each iteration of several seconds.
  9. Whilst the workflow is running, you can un-tick / tick the "Enable parallel looping" checkbox to toggle between synchronous and parallel execution.
  10. Notice that when parallel looping is enabled that multiple iterations are performed in parallel. In fact, the number of iterations performed in parallel will be equal to the number of processors you have on your local machine.
A sample execution of the workflow

Configuring the amount of work performed in parallel

  1. Within the workspace editor, select the settings menu (you can find this at the top of the workspace editor beneath the application's title bar) and choose the configure application menu item.
  2. Select the parallel / remote execution entry from the left hand configuration panel.
  3. Increment the field label maximum local threads to some value greater or less than the current value.
  4. Close the settings screen and re-run your workflow.
  5. You should see that the number of iterations performed in parallel is equal to the maximum thread count you specified above.
The Parallel / Remote execution settings screen

Summary

This concludes the tutorial on parallelising workflow execution on a local machine.