mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 00:49:33 +02:00
Revert the switch to futures for now
Without it, we get random hangs on parse failure. With it, some folks have seen hangs even on successful cases. The former is clearly less problematic. This is temporary, until I can finish investigating the root causes of both issues. (Bitbake rev: db689a99beffea1a285cdfc74a58fe73f1666987) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d366c1890e
commit
754847f34b
@@ -32,7 +32,6 @@ import sre_constants
|
||||
import threading
|
||||
from cStringIO import StringIO
|
||||
from contextlib import closing
|
||||
from concurrent import futures
|
||||
from functools import wraps
|
||||
from collections import defaultdict
|
||||
import bb, bb.exceptions, bb.command
|
||||
@@ -1453,16 +1452,20 @@ class CookerParser(object):
|
||||
self.start()
|
||||
|
||||
def start(self):
|
||||
def init(cfg):
|
||||
parse_file.cfg = cfg
|
||||
multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cooker.configuration.data, ), exitpriority=1)
|
||||
|
||||
self.results = self.load_cached()
|
||||
|
||||
if self.toparse:
|
||||
bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
|
||||
|
||||
parse_file.cfg = self.cfgdata
|
||||
multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cfgdata,), exitpriority=1)
|
||||
self.executor = futures.ProcessPoolExecutor(max_workers=self.num_processes)
|
||||
self.futures = dict((self.executor.submit(parse_file, task), task) for task in self.willparse)
|
||||
self.results = itertools.chain(self.results, self.parse_gen())
|
||||
self.pool = multiprocessing.Pool(self.num_processes, init, [self.cfgdata])
|
||||
parsed = self.pool.imap(parse_file, self.willparse)
|
||||
self.pool.close()
|
||||
|
||||
self.results = itertools.chain(self.results, parsed)
|
||||
|
||||
def shutdown(self, clean=True):
|
||||
if not self.toparse:
|
||||
@@ -1475,9 +1478,8 @@ class CookerParser(object):
|
||||
self.total)
|
||||
bb.event.fire(event, self.cfgdata)
|
||||
else:
|
||||
for future in self.futures:
|
||||
future.cancel()
|
||||
self.executor.shutdown()
|
||||
self.pool.terminate()
|
||||
self.pool.join()
|
||||
|
||||
sync = threading.Thread(target=self.bb_cache.sync)
|
||||
sync.start()
|
||||
@@ -1489,15 +1491,6 @@ class CookerParser(object):
|
||||
cached, infos = self.bb_cache.load(filename, appends, self.cfgdata)
|
||||
yield not cached, infos
|
||||
|
||||
def parse_gen(self):
|
||||
for future in futures.as_completed(self.futures):
|
||||
task = self.futures[future]
|
||||
exc = future.exception()
|
||||
if exc:
|
||||
raise exc
|
||||
else:
|
||||
yield future.result()
|
||||
|
||||
def parse_next(self):
|
||||
try:
|
||||
parsed, result = self.results.next()
|
||||
|
||||
Reference in New Issue
Block a user