Skip to contentSkip to conversation

cooker: Only start as many parse threads as we need

PATCH New Richard Purdie 1 participant 1 message Jan 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cooker: Only start as many parse threads as we need

If we're only going to parse one recipe, no point in starting a large number of threads.

bitbake/lib/bb/cooker.py +3 -2
index a1182ef..1f4174f 100644
@@ -1986,8 +1986,6 @@ class CookerParser(object):
         self.total = len(filelist)
 
         self.current = 0
-        self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or
-                                 multiprocessing.cpu_count())
         self.process_names = []
 
         self.bb_cache = bb.cache.Cache(self.cfgdata, self.cfghash, cooker.caches_array)
@@ -2002,6 +2000,9 @@ class CookerParser(object):
         self.toparse = self.total - len(self.fromcache)
         self.progress_chunk = max(self.toparse / 100, 1)
 
+        self.num_processes = min(int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or
+                                 multiprocessing.cpu_count()), len(self.willparse))
+
         self.start()
         self.haveshutdown = False