[3/3] knotty.py: Separate the display of main tasks from running tasks

Message ID 20220307133620.12404-3-pkj@axis.com
State New
Headers show
Series [1/3] knotty.py: Improve the message while waiting for running tasks to finish | expand

Commit Message

Peter Kjellerstedt March 7, 2022, 1:36 p.m. UTC
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

It can be confusing that the count of running tasks shown together with
the progress bar for the main tasks also includes any running setscene
tasks.

Separate the display so that the message for the main tasks' progress
bar only includes information on the main tasks, and the display of the
count of currently running tasks gets it own line.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---

This should be considered an RFC. With this change, the progress lines
for the setscene tasks and the main tasks (is that a good name for
those tasks?) look the same. The drawback is that it adds a line to
the display.

 bitbake/lib/bb/ui/knotty.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Richard Purdie March 7, 2022, 3:46 p.m. UTC | #1
On Mon, 2022-03-07 at 14:36 +0100, Peter Kjellerstedt wrote:
> From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> 
> It can be confusing that the count of running tasks shown together with
> the progress bar for the main tasks also includes any running setscene
> tasks.
> 
> Separate the display so that the message for the main tasks' progress
> bar only includes information on the main tasks, and the display of the
> count of currently running tasks gets it own line.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
> 
> This should be considered an RFC. With this change, the progress lines
> for the setscene tasks and the main tasks (is that a good name for
> those tasks?) look the same. The drawback is that it adds a line to
> the display.

I'm not keen. The progress bar only relates to "real" tasks, not setscene ones.
I know some of the running tasks might be setscene ones but that was a
compromise in the previous patches to keep the number of lines minimal. I wasn't
convinced that issue mattered that much in reality.

Cheers,

Richard
Peter Kjellerstedt March 7, 2022, 4:01 p.m. UTC | #2
> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: den 7 mars 2022 16:46
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-
> devel@lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH 3/3] knotty.py: Separate the display
> of main tasks from running tasks
> 
> On Mon, 2022-03-07 at 14:36 +0100, Peter Kjellerstedt wrote:
> > From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> >
> > It can be confusing that the count of running tasks shown together with
> > the progress bar for the main tasks also includes any running setscene
> > tasks.
> >
> > Separate the display so that the message for the main tasks' progress
> > bar only includes information on the main tasks, and the display of the
> > count of currently running tasks gets it own line.
> >
> > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > ---
> >
> > This should be considered an RFC. With this change, the progress lines
> > for the setscene tasks and the main tasks (is that a good name for
> > those tasks?) look the same. The drawback is that it adds a line to
> > the display.
> 
> I'm not keen. The progress bar only relates to "real" tasks, not setscene
> ones. I know some of the running tasks might be setscene ones but that was 
> a compromise in the previous patches to keep the number of lines minimal. 
> I wasn't convinced that issue mattered that much in reality.

As I said, this was just an RFC. I can live without it.

> 
> Cheers,
> 
> Richard

//Peter

Patch

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 179cea43fa..947fa73a13 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -293,10 +293,7 @@  class TerminalFilter(object):
 
             curtask = self.helper.tasknumber_current
             maxtask = self.helper.tasknumber_total
-            if not len(activetasks):
-                msg = "No running tasks (%s of %s)" % (curtask, maxtask)
-            else:
-                msg = "%2s running tasks (%s of %s)" % (len(activetasks), curtask, maxtask)
+            msg = "Main tasks (%s of %s)" % (curtask, maxtask)
             if not self.main_progress or self.main_progress.maxval != maxtask:
                 widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
                 self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
@@ -307,6 +304,12 @@  class TerminalFilter(object):
             print('')
         lines = self.getlines(content)
         if not self.quiet:
+            if not len(activetasks):
+                content = "No running tasks"
+            else:
+                content = "%2s running tasks:" % len(activetasks)
+            print(content)
+            lines += self.getlines(content)
             for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]):
                 if isinstance(task, tuple):
                     pbar, progress, rate, start_time = task