Try to guess CPU count correctly.
authorCarl Hetherington <cth@carlh.net>
Fri, 4 Oct 2019 16:17:11 +0000 (18:17 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 4 Oct 2019 16:17:11 +0000 (18:17 +0200)
cdist

diff --git a/cdist b/cdist
index 0f7290ec925c2e8492cb411cf4df96e975ffd3cd..f613ee25ea7340f0aaa878f76d5686eda276c92d 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -30,6 +30,7 @@ import copy
 import inspect
 import getpass
 import shlex
+import multiprocessing
 
 TEMPORARY_DIRECTORY = '/var/tmp'
 
@@ -109,7 +110,7 @@ class Config:
                          BoolOption('docker_no_user'),
                          Option('docker_hub_repository'),
                          Option('flatpak_state_dir'),
-                         Option('parallel', 4) ]
+                         Option('parallel', multiprocessing.cpu_count()) ]
 
         try:
             f = open('%s/.config/cdist' % os.path.expanduser('~'), 'r')