[PATCH 3/5] sstate.bbclass: get the number of threads with cpu_count from oe utils

Jose Quaresma
2021-08-09T09:49:15Z

It uses the python os.sched_getaffinity and it is more acurrate

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
meta/classes/sstate.bbclass | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index c3c145e7f3..63085a7f3a 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -964,13 +964,12 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
tasklist.append((tid, sstatefile))

if tasklist:
+ nproc = min(oe.utils.cpu_count(), len(tasklist))
+
if len(tasklist) >= min_tasks:
msg = "Checking sstate mirror object availability"
bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)

- import multiprocessing
- nproc = min(multiprocessing.cpu_count(), len(tasklist))
-
bb.event.enable_threadlock()
pool = oe.utils.ThreadedPool(nproc, len(tasklist),
worker_init=checkstatus_init, worker_end=checkstatus_end)
--
2.32.0