bitbake: runqueue: Process unihashes in parallel at init

Improve the runqueue init code to call unihash queries in parallel since
this is faster and more efficient, particularly on slower links with longer
round trip times.

The call to the function from cooker is unneeded since that function calls
prepare() and hence this functionality will already have run, so drop
that obsolete call.

(Bitbake rev: e0486054c7a4c637446c18608e9983cc8dc4d7fe)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Richard Purdie 2024-05-24 12:00:01 +01:00 committed by Steve Sakoman
parent fa23d0fc6d
commit cc341e44bf
2 changed files with 10 additions and 9 deletions

View File

@ -1459,7 +1459,6 @@ class BBCooker:
if t in task or getAllTaskSignatures:
try:
rq.rqdata.prepare_task_hash(tid)
sig.append([pn, t, rq.rqdata.get_task_unihash(tid)])
except KeyError:
sig.append(self.getTaskSignatures(target, [t])[0])

View File

@ -1280,11 +1280,18 @@ class RunQueueData:
dealtwith = set()
todeal = set(self.runtaskentries)
while todeal:
ready = set()
for tid in todeal.copy():
if not (self.runtaskentries[tid].depends - dealtwith):
dealtwith.add(tid)
todeal.remove(tid)
self.prepare_task_hash(tid)
self.runtaskentries[tid].taskhash_deps = bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches)
# get_taskhash for a given tid *must* be called before get_unihash* below
self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches)
ready.add(tid)
unihashes = bb.parse.siggen.get_unihashes(ready)
for tid in ready:
dealtwith.add(tid)
todeal.remove(tid)
self.runtaskentries[tid].unihash = unihashes[tid]
bb.event.check_for_interrupts(self.cooker.data)
@ -1301,11 +1308,6 @@ class RunQueueData:
#self.dump_data()
return len(self.runtaskentries)
def prepare_task_hash(self, tid):
self.runtaskentries[tid].taskhash_deps = bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches)
self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches)
self.runtaskentries[tid].unihash = bb.parse.siggen.get_unihash(tid)
def dump_data(self):
"""
Dump some debug information on the internal data structures