Skip to content

A tool that helps with running tasks in parallel across multiple workers on CircleCI the ~ideal way.

License

Notifications You must be signed in to change notification settings

honzabrecka/partition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

partition

A tool that helps with running tasks in parallel across multiple workers on CircleCI the ~ideal way.

Motivation

Suppose you have 5 tests (pair of name and execution time) {A: 12, B: 2, C: 8, D: 2, E: 5} and 2 workers {X, Y} and you want to preserve the overall execution time as small as possible. The naïve solution won't work - in this case you may end up with subsets {A: 12, C: 8, E: 5} and {B: 2, D: 2}. These subsets lead to a big difference between total execution time of each worker - 25 (86.2%) vs. 4 (13.8%). The reason is that the exection times of each test are completely ignored.

Here comes the partition, which solves this problem almost ideally: Subsets produced by partition are {A: 12, B: 2} and {C: 8, D: 2, E: 5} - 14 (48.3%) vs. 15 (51.7%).

How it works?

  1. Reads saved output from the previous successfull run. Each test in the output has to contain filename and execution time. To obtain the output from the previous run you need to have an access token to build artifacts.
  2. Loads all files in current test suite(s). Tests may be added and/or deleted accross runs.
  3. Applies solution of minimal difference partition problem to the set of execution times.

Usage

$ java -jar partition.jar --token <ACCESS_TOKEN> <PATH_TO_TESTS>

## Modes

Mode can be set by -m (--mode) option.

  • delete: By default, partition operates in delete mode, which means that only files contained in bucket are preserved; other files are deleted.
  • copy - Second mode called copy copies files contained in bucket to newly created directory; original directory is left untouched.

Example of circle.yml

dependencies:
  post:
   - java -jar partition.jar --token <ACCESS_TOKEN> test/features:
       {parallel: true}

test:
  override:
    - set -o pipefail; nightwatch -g test/features | tee nightwatch_output:
        {parallel: true}

general:
  artifacts:
    - nightwatch_output

Test

CircleCI

$ lein test partition.core

About

A tool that helps with running tasks in parallel across multiple workers on CircleCI the ~ideal way.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published