Minor fixes for progress reporting
cover Minor fixes for progress reporting
Fix/tweak a few things in the progress reporting code.
The following changes since commit 5fa0b3a19e7d0f40790f737abeddf499d53f1f6a:
bitbake: implement idle timeout for xmlrpc server (2016-07-21 07:48:35 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib paule/bb-progress-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-progress-fixes
Paul Eggleton (3):
knotty: fix some minor bugs in BBProgress
knotty: don't display ETA for tasks with progress lib/bb/progress: avoid possibility of start event being reported twice
lib/bb/progress.py | 5 ++++- lib/bb/ui/knotty.py | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-)
Signature · 1 line
2.5.5
PATCH 1/3 knotty: fix some minor bugs in BBProgress
If you specify custom widgets then we don't want to assume where the "extra" position is - you should have to specify it, and if it isn't specified it shouldn't just wipe out the last widget or you can start to see odd behaviour if you're modifying the code.
--- lib/bb/ui/knotty.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
lib/bb/ui/knotty.py +13 -12
@@ -40,9 +40,9 @@ logger = logging.getLogger("BitBake") interactive = sys.stdout.isatty() class BBProgress(progressbar.ProgressBar): - def __init__(self, msg, maxval, widgets=None): + def __init__(self, msg, maxval, widgets=None, extrapos=-1): self.msg = msg - self.extrapos = -1 + self.extrapos = extrapos if not widgets: widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()]
@@ -69,15 +69,16 @@ class BBProgress(progressbar.ProgressBar): self.widgets[0] = msg def setextra(self, extra): - if extra: - extrastr = str(extra) - if extrastr[0] != ' ': - extrastr = ' ' + extrastr - if extrastr[-1] != ' ': - extrastr += ' ' - else: - extrastr = ' ' - self.widgets[self.extrapos] = extrastr + if self.extrapos > -1: + if extra: + extrastr = str(extra) + if extrastr[0] != ' ': + extrastr = ' ' + extrastr + if extrastr[-1] != ' ': + extrastr += ' ' + else: + extrastr = ' ' + self.widgets[self.extrapos] = extrastr def _need_update(self): # We always want the bar to print when update() is called
@@ -241,7 +242,7 @@ class TerminalFilter(object): start_time = activetasks[t].get("starttime", None) if not pbar or pbar.bouncing != (progress < 0): if progress < 0: - pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider()]) + pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2) pbar.bouncing = True else: pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100)
Signature · 1 line
2.5.5
PATCH 2/3 knotty: don't display ETA for tasks with progress
In reply to Paul EggletonIt turns out that progress information we can extract from a task is rarely apportioned closely enough to the time taken for the ETA to be accurate, so showing it is going to be misleading most of the time for anything but the most basic of examples. Let's just remove it and avoid misleading (or worse, annoying) the user.
Fixes [YOCTO #9986].
--- lib/bb/ui/knotty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/ui/knotty.py +1 -1
@@ -245,7 +245,7 @@ class TerminalFilter(object): pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2) pbar.bouncing = True else: - pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100) + pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4) pbar.bouncing = False activetasks[t]["progressbar"] = pbar tasks.append((pbar, progress, rate, start_time))
Signature · 1 line
2.5.5
PATCH 3/3 lib/bb/progress: avoid possibility of start event being reported twice
In reply to Paul EggletonIn MultiStageProgressReporter, set a guard when we start the progress so that it can't happen more than once. This fixes "Initialising tasks.." being shown twice in succession when running bitbake in non-interactive terminal mode.
--- lib/bb/progress.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/progress.py +4 -1
@@ -234,10 +234,13 @@ class MultiStageProcessProgressReporter(MultiStageProgressReporter): """ def __init__(self, d, processname, stage_weights, debug=False): self._processname = processname + self._started = False MultiStageProgressReporter.__init__(self, d, stage_weights, debug) def start(self): - bb.event.fire(bb.event.ProcessStarted(self._processname, 100), self._data) + if not self._started: + bb.event.fire(bb.event.ProcessStarted(self._processname, 100), self._data) + self._started = True def _fire_progress(self, taskprogress): if taskprogress == 0:
Signature · 1 line
2.5.5