All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish
@ 2022-03-07 13:36 Peter Kjellerstedt
  2022-03-07 13:36 ` [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Peter Kjellerstedt
  2022-03-07 13:36 ` [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Peter Kjellerstedt
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2022-03-07 13:36 UTC (permalink / raw)
  To: bitbake-devel

From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

Use pluralise() to correct the grammar, and drop the colon at the end if
runnning in quiet mode.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/lib/bb/ui/knotty.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index b02e59c1fe..a520895da2 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -272,7 +272,10 @@ class TerminalFilter(object):
                     tasks.append("%s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]))
 
         if self.main.shutdown:
-            content = "Waiting for %s running tasks to finish:" % len(activetasks)
+            content = pluralise("Waiting for %s running task to finish",
+                                "Waiting for %s running tasks to finish", len(activetasks))
+            if not self.quiet:
+                content += ':'
             print(content)
         else:
             if self.quiet:


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar
  2022-03-07 13:36 [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish Peter Kjellerstedt
@ 2022-03-07 13:36 ` Peter Kjellerstedt
  2022-03-07 15:48   ` [bitbake-devel] " Richard Purdie
  2022-03-07 13:36 ` [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Peter Kjellerstedt
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Kjellerstedt @ 2022-03-07 13:36 UTC (permalink / raw)
  To: bitbake-devel

From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

In commit 8055ec36 (knotty: Improve setscene task display) the setscene
tasks got their own line in the task output. However, the progress bar
code does not handle newlines in its widgets, so the length of the
setscene line was included when calculating how much space is available
for the progress bar of the running tasks, making it much too short.

Instead of trying to teach the progress bar code to handle newlines,
give the setscene tasks their own progress bar.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/lib/bb/ui/knotty.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index a520895da2..179cea43fa 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -204,6 +204,7 @@ class TerminalFilter(object):
         for h in handlers:
             h.addFilter(InteractConsoleLogFilter(self))
 
+        self.setscene_progress = None
         self.main_progress = None
 
     def clearFooter(self):
@@ -278,25 +279,34 @@ class TerminalFilter(object):
                 content += ':'
             print(content)
         else:
-            if self.quiet:
-                content = "Running tasks (%s of %s, %s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
-            elif not len(activetasks):
-                content = "Setscene tasks: %s of %s\nNo currently running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, self.helper.tasknumber_current, self.helper.tasknumber_total)
-            else:
-                content = "Setscene tasks: %s of %s\nCurrently %2s running tasks (%s of %s)" % (self.helper.setscene_current, self.helper.setscene_total, len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total)
+            content = ''
+            curtask = self.helper.setscene_current
+            maxtask = self.helper.setscene_total
+            msg = "Setscene tasks (%s of %s)" % (curtask, maxtask)
+            if not self.setscene_progress or self.setscene_progress.maxval != maxtask:
+                widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
+                self.setscene_progress = BBProgress("Setscene tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
+                self.setscene_progress.start(False)
+            self.setscene_progress.setmessage(msg)
+            content += self.setscene_progress.update(curtask) + "\n"
+            print('')
+
+            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)
             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)
                 self.main_progress.start(False)
-            self.main_progress.setmessage(content)
-            progress = self.helper.tasknumber_current - 1
-            if progress < 0:
-                progress = 0
-            content = self.main_progress.update(progress)
+            self.main_progress.setmessage(msg)
+            progress = max(0, curtask - 1)
+            content += self.main_progress.update(progress)
             print('')
         lines = self.getlines(content)
-        if self.quiet == 0:
+        if not self.quiet:
             for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]):
                 if isinstance(task, tuple):
                     pbar, progress, rate, start_time = task


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks
  2022-03-07 13:36 [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish Peter Kjellerstedt
  2022-03-07 13:36 ` [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Peter Kjellerstedt
@ 2022-03-07 13:36 ` Peter Kjellerstedt
  2022-03-07 15:46   ` [bitbake-devel] " Richard Purdie
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Kjellerstedt @ 2022-03-07 13:36 UTC (permalink / raw)
  To: bitbake-devel

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(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [bitbake-devel] [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks
  2022-03-07 13:36 ` [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Peter Kjellerstedt
@ 2022-03-07 15:46   ` Richard Purdie
  2022-03-07 16:01     ` Peter Kjellerstedt
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2022-03-07 15:46 UTC (permalink / raw)
  To: Peter Kjellerstedt, bitbake-devel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bitbake-devel] [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar
  2022-03-07 13:36 ` [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Peter Kjellerstedt
@ 2022-03-07 15:48   ` Richard Purdie
  2022-03-07 16:00     ` Peter Kjellerstedt
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2022-03-07 15:48 UTC (permalink / raw)
  To: Peter Kjellerstedt, bitbake-devel

On Mon, 2022-03-07 at 14:36 +0100, Peter Kjellerstedt wrote:
> From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> 
> In commit 8055ec36 (knotty: Improve setscene task display) the setscene
> tasks got their own line in the task output. However, the progress bar
> code does not handle newlines in its widgets, so the length of the
> setscene line was included when calculating how much space is available
> for the progress bar of the running tasks, making it much too short.
> 
> Instead of trying to teach the progress bar code to handle newlines,
> give the setscene tasks their own progress bar.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  bitbake/lib/bb/ui/knotty.py | 34 ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)

I'd much prefer not to add yet another confusing progress bar as it will just
confuse users more. The real progress to watch is the real tasks one and that
will increase as setscene tasks are covered.

Adding this draws the user's attention away from where they probably want to be
looking. If you know otherwise, you don't need the progress bar IMO.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [bitbake-devel] [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar
  2022-03-07 15:48   ` [bitbake-devel] " Richard Purdie
@ 2022-03-07 16:00     ` Peter Kjellerstedt
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2022-03-07 16:00 UTC (permalink / raw)
  To: Richard Purdie, bitbake-devel@lists.openembedded.org

> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: den 7 mars 2022 16:48
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-
> devel@lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH 2/3] knotty.py: Give the setscene
> tasks their own progress bar
> 
> On Mon, 2022-03-07 at 14:36 +0100, Peter Kjellerstedt wrote:
> > From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> >
> > In commit 8055ec36 (knotty: Improve setscene task display) the setscene
> > tasks got their own line in the task output. However, the progress bar
> > code does not handle newlines in its widgets, so the length of the
> > setscene line was included when calculating how much space is available
> > for the progress bar of the running tasks, making it much too short.
> >
> > Instead of trying to teach the progress bar code to handle newlines,
> > give the setscene tasks their own progress bar.
> >
> > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > ---
> >  bitbake/lib/bb/ui/knotty.py | 34 ++++++++++++++++++++++------------
> >  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> I'd much prefer not to add yet another confusing progress bar as it will
> just confuse users more. The real progress to watch is the real tasks 
> one and that will increase as setscene tasks are covered.

Hmm, my first solution was without the progress bar. However, when 
I realized that a progress bar could be used instead, I thought it 
made sense.

Consider the case where you are making a build which has almost 
everything in the sstate cache, then the current output is less 
optimal. I.e., the first line will show a counter increasing, but 
no progress bar, while the second line shows a progress bar that 
basically goes from 0% to 100% in one step once all the setscene 
tasks are done.

> Adding this draws the user's attention away from where they probably want
> to be looking. If you know otherwise, you don't need the progress bar IMO.

Need is a strong word when it comes to the progress bars. Personally 
I like to watch them move along. :) I find it easier to get a view 
of the current progress by looking at the bars rather than the 
corresponding numbers.

> Cheers,
> 
> Richard

//Peter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [bitbake-devel] [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks
  2022-03-07 15:46   ` [bitbake-devel] " Richard Purdie
@ 2022-03-07 16:01     ` Peter Kjellerstedt
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2022-03-07 16:01 UTC (permalink / raw)
  To: Richard Purdie, bitbake-devel@lists.openembedded.org

> -----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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-07 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-07 13:36 [PATCH 1/3] knotty.py: Improve the message while waiting for running tasks to finish Peter Kjellerstedt
2022-03-07 13:36 ` [PATCH 2/3] knotty.py: Give the setscene tasks their own progress bar Peter Kjellerstedt
2022-03-07 15:48   ` [bitbake-devel] " Richard Purdie
2022-03-07 16:00     ` Peter Kjellerstedt
2022-03-07 13:36 ` [PATCH 3/3] knotty.py: Separate the display of main tasks from running tasks Peter Kjellerstedt
2022-03-07 15:46   ` [bitbake-devel] " Richard Purdie
2022-03-07 16:01     ` Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.