[dev] Running tests in parallel

20 views
Skip to first unread message

Federico Capoano

unread,
Apr 25, 2020, 10:10:42 PM4/25/20
to OpenWISP
I just discovered something interesting while I was reviewing the django documentation to ensure I was replying correctly in a pull request review for Ajay on openwisp-controller

It seems that since at least django 1.10 it has been possible to run tests in parallel, the docs say: "As long as your tests are properly isolated, you can run them in parallel to gain a speed up on multi-core hardware".

So I tried this on openwisp-controller, let's see how non-parallel and parallel compare on my laptop (which apparently has got an octa-core which means 8 cores):

Non-parallel (classic)

./runtests.py --keepdb

Ran 196 tests in 41.479s

Parallel

./runtests.py --keepdb --parallel

Ran 196 tests in 12.965s

WOW

That's a reduction in time of almost 69%! It's more than 3 times faster.
We should try this on all the modules and find out if there's some test which doesn't run in isolation and fix it, we may be able to drastically reduce the build time of each module, as well as help developers run tests faster!

Let's find out how many cores travis uses for its docker builds. What if it's more than 8 cores? That may result even faster.

Fed

Valere Gille Geovan Noumbissi

unread,
Apr 26, 2020, 2:59:23 AM4/26/20
to open...@googlegroups.com
Hello Federico,
This will be awesome. I have done a quick check and found the following:
- according to https://docs.travis-ci.com/user/reference/overview/ , the docker build should have just 2 cores available 
- but the report from https://travis-ci.community/t/nproc-reports-32-cores-on-arm64/5851 claims the arm64 architecture has 32 cores which will be awesome. I also saw this claim on Travis ci's blog announcement but they said it was still in it's alpha release.

- also, https://docs.travis-ci.com/user/speeding-up-the-build/  provides some tricks to speed up building and testing. Don't know if we could use some of that. 


--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/50ec5d66-6a00-4cd4-8e31-0f6b71906f53%40googlegroups.com.

Ajay Tripathi

unread,
Apr 26, 2020, 4:50:28 AM4/26/20
to OpenWISP
Hi,

I run a 2 core machine and it was noticeably faster for me as well, so I would say +1 for this on travis-ci.
Thanks for the info, I am starting this with controller module! :-)


Best,
Ajay Tripathi

Gagan Deep

unread,
Apr 26, 2020, 5:01:52 PM4/26/20
to open...@googlegroups.com
Hi,

coverage will be needed to tweaked accordingly for running tests parallel but Django docs suggests otherwise.

Coverage should be run in a single process to obtain accurate statistics.

I didn't tweaked coverage for openwisp-notifications module and coverage fell a lot.  😅

For reference: 

Regards,
Gagan Deep

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages