Limit parallelity when installing ansible

There seems to be some race in pip when doing parallel installations
of ansible into the different venvs which occasionally breaks
tests. This got worse with more supported versions. Thus limit to two
workers and see how much this helps.

Change-Id: If1cf6fedd68958f4a6c46f50ee51b04b69943f5c
This commit is contained in:
Tobias Henkel 2020-01-17 18:08:42 +01:00
parent f6863d1af1
commit 1941770f95
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 5 additions and 1 deletions

View File

@ -191,7 +191,11 @@ class AnsibleManager:
self.default_version = default_version
def install(self, upgrade=False):
with concurrent.futures.ThreadPoolExecutor() as executor:
# Note: With higher number of threads pip seems to have some race
# leading to occasional failures during setup of all ansible
# environments. Thus we limit the number of workers to reduce the risk
# of hitting this race.
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
futures = {executor.submit(a.ensure_ansible, upgrade): a
for a in self._supported_versions.values()}
for future in concurrent.futures.as_completed(futures):