summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-30 08:25:13 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:45 +0000
commitb8aedaa6b54eb81739c288b59a11e1df9f182ec5 (patch)
treec4b94e5cb4447cd08c5a790e06977ef4783a40cf
parentb890c19a3308ff88d8450a2811afd2b084f3aafe (diff)
downloadopenembedded-core-b8aedaa6b54eb81739c288b59a11e1df9f182ec5.tar.gz
openembedded-core-b8aedaa6b54eb81739c288b59a11e1df9f182ec5.tar.bz2
openembedded-core-b8aedaa6b54eb81739c288b59a11e1df9f182ec5.tar.xz
openembedded-core-b8aedaa6b54eb81739c288b59a11e1df9f182ec5.zip
cooker: no cached in progressbar and add ETA
Rather than updating the progress bar based on the recipe being processed (whether cached or parsed), consider only parsed recipes. This reduces the instability in progress rate introduced by the cached entries, and allows the ETA to be resurrected and be a bit more useful. (Bitbake rev: 618480f7739f6ae846f67a57bee5a78efb37839d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--bitbake/lib/bb/cooker.py24
-rw-r--r--bitbake/lib/bb/event.py4
-rw-r--r--bitbake/lib/bb/ui/knotty.py4
3 files changed, 12 insertions, 20 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f5a7b0292..e7fdb5a69 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -993,12 +993,10 @@ class CookerParser(object):
self.total = len(filelist)
self.current = 0
- self.started = False
self.bb_cache = None
self.task_queue = None
self.result_queue = None
self.fromcache = None
- self.progress_chunk = self.total / 100
self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or
multiprocessing.cpu_count())
@@ -1013,6 +1011,8 @@ class CookerParser(object):
self.task_queue.put((filename, appends))
else:
self.fromcache.append((filename, appends))
+ self.toparse = self.total - len(self.fromcache)
+ self.progress_chunk = self.toparse / 100
def worker(input, output, cfgdata):
signal.signal(signal.SIGINT, signal.SIG_IGN)
@@ -1061,14 +1061,10 @@ class CookerParser(object):
bb.event.fire(event, self.cfgdata)
self.shutdown()
return False
- elif not self.started:
- self.started = True
- bb.event.fire(bb.event.ParseStarted(self.total, self.skipped, self.masked),
- self.cfgdata)
- return True
elif not self.bb_cache:
self.bb_cache = bb.cache.Cache(self.cfgdata)
self.launch_processes()
+ bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
return True
try:
@@ -1076,11 +1072,17 @@ class CookerParser(object):
filename, appends = self.fromcache.pop()
_, result = self.bb_cache.load(filename, appends, self.cfgdata)
parsed = False
+ self.cached += 1
else:
result = self.result_queue.get()
if isinstance(result, Exception):
raise result
+
parsed = True
+ self.parsed += 1
+ if self.parsed % self.progress_chunk == 0:
+ bb.event.fire(bb.event.ParseProgress(self.parsed),
+ self.cfgdata)
except KeyboardInterrupt:
self.shutdown(clean=False)
raise
@@ -1088,10 +1090,6 @@ class CookerParser(object):
self.error += 1
parselog.critical(str(e))
else:
- if parsed:
- self.parsed += 1
- else:
- self.cached += 1
self.virtuals += len(result)
for virtualfn, info in result:
@@ -1100,10 +1098,6 @@ class CookerParser(object):
else:
self.bb_cache.add_info(virtualfn, info, self.cooker.status,
parsed=parsed)
- finally:
- # only fire events on percentage boundaries
- if self.current % self.progress_chunk == 0:
- bb.event.fire(bb.event.ParseProgress(self.current), self.cfgdata)
self.current += 1
return True
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 5b0a183ac..009cbf93b 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -298,11 +298,9 @@ class MultipleProviders(Event):
class ParseStarted(Event):
"""Recipe parsing for the runqueue has begun"""
- def __init__(self, total, skipped, masked):
+ def __init__(self, total):
Event.__init__(self)
self.total = total
- self.skipped = skipped
- self.masked = masked
class ParseCompleted(Event):
"""Recipe parsing for the runqueue has completed"""
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 8e5249bb6..0c0cdf1fe 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -31,7 +31,7 @@ from bb.ui import uihelper
logger = logging.getLogger("BitBake")
widgets = ['Parsing recipes: ', progressbar.Percentage(), ' ',
- progressbar.Bar()]
+ progressbar.Bar(), ' ', progressbar.ETA()]
class BBLogFormatter(logging.Formatter):
"""Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
@@ -147,7 +147,7 @@ def init(server, eventHandler):
continue
if isinstance(event, bb.event.ParseCompleted):
if interactive:
- pbar.update(event.total)
+ pbar.update(pbar.maxval)
else:
sys.stdout.write("done.\n")
sys.stdout.flush()