Concurrency and parallelism
Both concurrency of pipelines and parallel actions let you reduce the waiting time for an execution to finish.
The number of pipelines and actions that can be run simultaneously is specified in the workspace plan.
Concurrency of pipelines
Pipelines concurrency defines how many pipelines can run simultaneously. When more pipelines than your plan allows are running, the subsequent executions will be enqueued, waiting for all previously triggered pipelines to finish.
Two pipelines running in concurrency
Parallelism of actions
Thanks to parallelism you can execute multiple actions in one pipeline simultaneously.
For instance: to speed up your tests you can run several tests at the same time. Another common use case of parallel actions is deploying files to a couple of servers at once.
The number of possible parallel actions depends on the chosen plan. If your plan allows 2 concurrent pipelines and 2 parallel actions it means you can run 2 pipelines with 4 actions simultaneously (2 actions in each pipeline).
Below you can see how to configure your pipeline to run tests in parallel.
Run tests in parallel
- Create a new pipeline in your project.
- Choose the Split tests action from the actions list.
Split tests action
- Select the number of groups (packages) into which you want to to split the tests. In this example, we’ll use 3 packages.
- Choose if you want to sort them alphabetically or by file size.
- Provide the path to the directory with test files. You can do it in two ways:
- Select one file with the paths to split (each path in a separate line)
- Use glob patterns:
*
– matches any sequence of characters (excluding path separators)**
– matches any sequence of characters (including path separators)?
– matches any single character (excluding path separators)[abc]
– matches any character (excluding path separators) against characters in brackets{foo,bar,...}
– matches a sequence of characters, if any of the alternatives in braces matches
- Once done, save the action:
Split tests action configuration
- The action creates environment variables required to run the tests in parallel:
$BUDDY_SPLIT_1
,$BUDDY_SPLIT_2
,$BUDDY_SPLIT_3
, and so on. Once the pipeline is executed, you will see them in the logs.Split tests action logs
- Next, you need to prepare the environment for the tests (install dependencies etc.) in the selected build action:
Build action command console
- The last part is adding the actions that will run the tests using the proper variable from the Split tests action:
Setting proper variables from Split Tests action
You can see we have added 3 testing actions – this is because we chose to split the tests into 3 actions:
Split tests pipeline example
See also
Last modified on April 20, 2021