Skip to content

feat(parallel-tests): update Makefile to perform tests in parallel#533

Merged
glevco merged 4 commits intodevfrom
feat/parallel-tests
Mar 1, 2023
Merged

feat(parallel-tests): update Makefile to perform tests in parallel#533
glevco merged 4 commits intodevfrom
feat/parallel-tests

Conversation

@glevco
Copy link
Copy Markdown
Contributor

@glevco glevco commented Feb 23, 2023

I noticed that running our tests take a long time, usually more than 1 hour in our CI though GitHub Actions. I tried this simple pytest plugin, pytest-xdist, which parallelizes test runs in multiple CPU cores. It's the main recommended plugin for that purpose, and has more than 1.1k starts on GitHub.

It's hard to get exact statistics on job execution times for a precise benchmark, but from taking a look at previous PRs and comparing with runs on #532, the difference is noticeable. When running locally, on computers with more cores than the GitHub Actions runners, the time gains are even larger.

Acceptance criteria:

  • Install the pytest-xdist plugin
  • Update Makefile commands to parallelize tests

@glevco glevco added enhancement New feature or request tests labels Feb 23, 2023
@glevco glevco self-assigned this Feb 23, 2023
Copy link
Copy Markdown
Member

@msbrogli msbrogli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the performance gain in your computer?

@jansegre
Copy link
Copy Markdown
Member

I just noticed that the codecov wasn't updated (it needs the pytest plugin to run correctly). Maybe it's a one off error, can you check that it wasn't affected and that the codecov still updates correctly?

@glevco glevco force-pushed the feat/parallel-tests branch from ca51a4e to be3ca5e Compare February 24, 2023 18:36
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2023

Codecov Report

Merging #533 (c3704b7) into dev (42bfc1c) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##              dev     #533      +/-   ##
==========================================
+ Coverage   83.11%   83.14%   +0.02%     
==========================================
  Files         209      209              
  Lines       18512    18512              
  Branches     2587     2587              
==========================================
+ Hits        15386    15391       +5     
+ Misses       2560     2557       -3     
+ Partials      566      564       -2     
Impacted Files Coverage Δ
hathor/transaction/storage/transaction_storage.py 89.97% <0.00%> (ø)
hathor/p2p/node_sync.py 84.95% <0.00%> (+0.48%) ⬆️
hathor/p2p/manager.py 68.22% <0.00%> (+1.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@glevco
Copy link
Copy Markdown
Contributor Author

glevco commented Feb 24, 2023

What was the performance gain in your computer?

@msbrogli I ran make tests-lib on my computer (a Quad-Core Intel Core i7 MacBook Pro). In the dev branch, it takes 55minutes:

Screenshot 2023-02-24 at 15 31 52

In this branch, it takes 18 minutes:

Screenshot 2023-02-24 at 16 16 14

@glevco
Copy link
Copy Markdown
Contributor Author

glevco commented Feb 24, 2023

I just noticed that the codecov wasn't updated (it needs the pytest plugin to run correctly). Maybe it's a one off error, can you check that it wasn't affected and that the codecov still updates correctly?

@jansegre it was probably a one off, it has been updated now

@glevco glevco force-pushed the feat/parallel-tests branch from be3ca5e to 767f1dd Compare February 24, 2023 20:01
@msbrogli
Copy link
Copy Markdown
Member

What was the performance gain in your computer?

@msbrogli I ran make tests-lib on my computer (a Quad-Core Intel Core i7 MacBook Pro). In the dev branch, it takes 55minutes:

In this branch, it takes 18 minutes:

Thanks for the benchmark.

@glevco glevco force-pushed the feat/parallel-tests branch 3 times, most recently from c9960ef to c361c11 Compare February 27, 2023 18:58
@glevco glevco force-pushed the feat/parallel-tests branch from c361c11 to b316d96 Compare February 27, 2023 18:59
@glevco glevco merged commit 75b3c72 into dev Mar 1, 2023
@glevco glevco deleted the feat/parallel-tests branch March 1, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants