diff options
| author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-06-23 17:55:29 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:55:46 +0100 |
| commit | 7f8286fb9ec9f9d9f606c69e5abd717078ace5b2 (patch) | |
| tree | ab56ab1b724d9c777d2ddfc3e054535f3f9b3694 | |
| parent | 76993861a1b9e1350853192df4d699254d74f319 (diff) | |
| download | poky-7f8286fb9ec9f9d9f606c69e5abd717078ace5b2.tar.gz | |
classes/sstate.bbclass: Improve checkstatus using connection cache.
Use FetcherConnectionCache to improve times when do checkstatus over
sstate resources.
[YOCTO #7796]
(From OE-Core rev: e6f66370c6ce15aca18ef64491bab3dc92b80c57)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/sstate.bbclass | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 1e2d4f6fc0..5b64b493e9 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
| @@ -739,6 +739,13 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False): | |||
| 739 | if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1": | 739 | if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1": |
| 740 | localdata.delVar('BB_NO_NETWORK') | 740 | localdata.delVar('BB_NO_NETWORK') |
| 741 | 741 | ||
| 742 | from bb.fetch2 import FetchConnectionCache | ||
| 743 | def checkstatus_init(thread_worker): | ||
| 744 | thread_worker.connection_cache = FetchConnectionCache() | ||
| 745 | |||
| 746 | def checkstatus_end(thread_worker): | ||
| 747 | thread_worker.connection_cache.close_connections() | ||
| 748 | |||
| 742 | def checkstatus(thread_worker, arg): | 749 | def checkstatus(thread_worker, arg): |
| 743 | (task, sstatefile) = arg | 750 | (task, sstatefile) = arg |
| 744 | 751 | ||
| @@ -748,7 +755,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False): | |||
| 748 | bb.debug(2, "SState: Attempting to fetch %s" % srcuri) | 755 | bb.debug(2, "SState: Attempting to fetch %s" % srcuri) |
| 749 | 756 | ||
| 750 | try: | 757 | try: |
| 751 | fetcher = bb.fetch2.Fetch(srcuri.split(), localdata2) | 758 | fetcher = bb.fetch2.Fetch(srcuri.split(), localdata2, |
| 759 | connection_cache=thread_worker.connection_cache) | ||
| 752 | fetcher.checkstatus() | 760 | fetcher.checkstatus() |
| 753 | bb.debug(2, "SState: Successful fetch test for %s" % srcuri) | 761 | bb.debug(2, "SState: Successful fetch test for %s" % srcuri) |
| 754 | ret.append(task) | 762 | ret.append(task) |
| @@ -771,7 +779,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False): | |||
| 771 | bb.note("Checking sstate mirror object availability (for %s objects)" % len(tasklist)) | 779 | bb.note("Checking sstate mirror object availability (for %s objects)" % len(tasklist)) |
| 772 | import multiprocessing | 780 | import multiprocessing |
| 773 | nproc = min(multiprocessing.cpu_count(), len(tasklist)) | 781 | nproc = min(multiprocessing.cpu_count(), len(tasklist)) |
| 774 | pool = oe.utils.ThreadedPool(nproc, len(tasklist)) | 782 | |
| 783 | pool = oe.utils.ThreadedPool(nproc, len(tasklist), | ||
| 784 | worker_init=checkstatus_init, worker_end=checkstatus_end) | ||
| 775 | for t in tasklist: | 785 | for t in tasklist: |
| 776 | pool.add_task(checkstatus, t) | 786 | pool.add_task(checkstatus, t) |
| 777 | pool.start() | 787 | pool.start() |
