mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
better limiting of forks to lowest actual restriction
This commit is contained in:
parent
b529f8b964
commit
0abeff4511
1 changed files with 2 additions and 4 deletions
|
@ -93,10 +93,8 @@ class TaskQueueManager:
|
||||||
self._connection_lockfile = tempfile.TemporaryFile()
|
self._connection_lockfile = tempfile.TemporaryFile()
|
||||||
|
|
||||||
# Treat "forks" config parameter as max value. Only create number of workers
|
# Treat "forks" config parameter as max value. Only create number of workers
|
||||||
# equal to number of hosts in inventory if less than max value.
|
# equal to number of hosts in inventory if less than max value or serial batch.
|
||||||
num_workers = self._options.forks
|
num_workers = min(self._options.forks, self._options.serial, len(self._inventory.list_hosts()))
|
||||||
if self._options.forks > len(self._inventory.list_hosts()):
|
|
||||||
num_workers = len(self._inventory.list_hosts())
|
|
||||||
|
|
||||||
self._workers = []
|
self._workers = []
|
||||||
for i in range(num_workers):
|
for i in range(num_workers):
|
||||||
|
|
Loading…
Reference in a new issue