aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-01 22:16:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-03 16:38:45 +0100
commit1f839f233ebe46421ada54d88a37713ea0a6bcad (patch)
treeaf2342a379d981980f57f0b4ea4f6b1eee99ce08 /meta/classes/sstate.bbclass
parent5331bbc1ac797e7503dd7fcf9780b0eab7274fc7 (diff)
downloadopenembedded-core-contrib-1f839f233ebe46421ada54d88a37713ea0a6bcad.tar.gz
sstate: Parallelise checkstatus calls for sstate mirror
Currently the urls are checked serially which is a performance bottleneck when looking at http:// urls in particular. This adds code to check the url status in parallel, mirroring the way we do this elsewhere. We need the datastore for the fetcher so we use threads, not multiprocess. (From OE-Core rev: 77c4865bbde4cd2a061cf333f9ad798afc6de0ef) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass28
1 files changed, 20 insertions, 8 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index b48504429f..de3519a69e 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -715,20 +715,16 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1":
localdata.delVar('BB_NO_NETWORK')
- for task in range(len(sq_fn)):
- if task in ret:
- continue
-
- spec, extrapath, tname = getpathcomponents(task, d)
-
- sstatefile = d.expand(extrapath + generate_sstatefn(spec, sq_hash[task], d) + "_" + tname + extension)
+ def checkstatus(arg):
+ (task, sstatefile) = arg
+ localdata2 = bb.data.createCopy(localdata)
srcuri = "file://" + sstatefile
localdata.setVar('SRC_URI', srcuri)
bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
try:
- fetcher = bb.fetch2.Fetch(srcuri.split(), localdata)
+ fetcher = bb.fetch2.Fetch(srcuri.split(), localdata2)
fetcher.checkstatus()
bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
ret.append(task)
@@ -739,6 +735,22 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
pass
+ tasklist = []
+ for task in range(len(sq_fn)):
+ if task in ret:
+ continue
+ spec, extrapath, tname = getpathcomponents(task, d)
+ sstatefile = d.expand(extrapath + generate_sstatefn(spec, sq_hash[task], d) + "_" + tname + extension)
+ tasklist.append((task, sstatefile))
+
+ if tasklist:
+ import multiprocessing
+ nproc = min(multiprocessing.cpu_count(), len(tasklist))
+ pool = oe.utils.ThreadedPool(nproc)
+ for t in tasklist:
+ pool.add_task(checkstatus, t)
+ pool.wait_completion()
+
inheritlist = d.getVar("INHERIT", True)
if "toaster" in inheritlist:
evdata = {'missed': [], 'found': []};