Creating test databases in parallel

18 views
Skip to first unread message

cool-RR

unread,
Apr 1, 2020, 5:25:22 AM4/1/20
to Django users
Hi guys,

I'm trying to optimize our Django testing workflow.

We have 7 different databases, and Django spends a lot of time on these lines: 

Creating test database for alias 'main_database'...
Creating test database for alias 'foo_database'...
Creating test database for alias 'bar_database'...
Creating test database for alias 'baz_database'...

This is especially annoying when you're running just one test, but have to wait 1:30 minutes just for these test databases.

Is there any way to speed this up? Either by parallelizing it or in any other way. A few months ago I tried some naive code that parallelizes these actions, but it failed. (Unfortunately I don't have the error message saved.)


Thanks,
Ram.

Motaz Hejaze

unread,
Apr 1, 2020, 6:20:27 AM4/1/20
to Django users
Long article somehow , but very informative ...


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com.

Ram Rachum

unread,
Apr 1, 2020, 6:24:22 AM4/1/20
to django-users
This is a general article about concurrency in Python. I'm very good with concurrency in Python, I'm asking about a specific case here.

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/-djWwBB5xac/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHV4E-c9dGVSG69K%3DNN3GUuVDrAGacLijQeDD6ZFUU3LXNPL3Q%40mail.gmail.com.

Thomas Lockhart

unread,
Apr 1, 2020, 1:13:03 PM4/1/20
to django...@googlegroups.com
If you are trying to optimize the test flow, then you may want to spend some time shrinking your test databases to a more manageable size. Or have two sets; abbreviated and full, with the larger one to exercise your (unknown) edge cases.

hth

- Tom

Ram Rachum

unread,
Apr 2, 2020, 3:58:13 AM4/2/20
to django-users
When you say "shrinking your test databases", what do you mean exactly? I'm a bit of a newbie on that part of Django.

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/-djWwBB5xac/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/43DDD6E9-EAA8-4162-BDB3-665F3CCA00E0%40gmail.com.
Reply all
Reply to author
Forward
0 new messages