diff mbox series

[2/2] knotty: report cache validity checking progress

Message ID 20250214211403.493573-2-chris.laplante@agilent.com
State New
Headers show
Series [1/2] cooker/event: add cache validity checking events | expand

Commit Message

chris.laplante@agilent.com Feb. 14, 2025, 9:14 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/ui/knotty.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

--
2.43.0

Comments

Ross Burton Feb. 18, 2025, 1:20 p.m. UTC | #1
On 14 Feb 2025, at 21:14, Chris Laplante via lists.openembedded.org <chris.laplante=agilent.com@lists.openembedded.org> wrote:
> +            if isinstance(event, bb.event.CheckCacheValidityStarted):
> +                if params.options.quiet > 1:
> +                    continue
> +                cacheprogress = new_progress("Checking cache validity", event.total).start()
> +                continue
> +
> +            if isinstance(event, bb.event.CheckCacheValidityProgress):
> +                if params.options.quiet > 1:
> +                    continue
> +                cacheprogress.update(event.current)
> +                continue
> +
> +            if isinstance(event, bb.event.CheckCacheValidityCompleted):
> +                if params.options.quiet > 1:
> +                    continue
> +                cacheprogress.finish()
> +                if params.options.quiet == 0:
> +                    print(f"Checked {event.total:d} cache entries for validity.")
> +                continue
> +

Multiple progress bars are quite a strong dark pattern: if you don’t know how many progress bars there are then there’s nothing to be gained by seeing progress bar after progress bar.

Personally I’d prefer it if these were collapsed into a single bar that had hidden internal divisions.  Yes, it would be bursty, but at least it would start at 0% and end at 100%.

Ross
chris.laplante@agilent.com Feb. 18, 2025, 1:59 p.m. UTC | #2
Hi Ross,

> On 14 Feb 2025, at 21:14, Chris Laplante via lists.openembedded.org
> <chris.laplante=agilent.com@lists.openembedded.org> wrote:
> > +            if isinstance(event, bb.event.CheckCacheValidityStarted):
> > +                if params.options.quiet > 1:
> > +                    continue
> > +                cacheprogress = new_progress("Checking cache validity",
> event.total).start()
> > +                continue
> > +
> > +            if isinstance(event, bb.event.CheckCacheValidityProgress):
> > +                if params.options.quiet > 1:
> > +                    continue
> > +                cacheprogress.update(event.current)
> > +                continue
> > +
> > +            if isinstance(event, bb.event.CheckCacheValidityCompleted):
> > +                if params.options.quiet > 1:
> > +                    continue
> > +                cacheprogress.finish()
> > +                if params.options.quiet == 0:
> > +                    print(f"Checked {event.total:d} cache entries for validity.")
> > +                continue
> > +
> 
> Multiple progress bars are quite a strong dark pattern: if you don't know how
> many progress bars there are then there's nothing to be gained by seeing
> progress bar after progress bar.
> 
> Personally I'd prefer it if these were collapsed into a single bar that had hidden
> internal divisions.  Yes, it would be bursty, but at least it would start at 0% and
> end at 100%.

Which multiple progress bars are you referring to? Do you mean the separate progress bar for loading cache and checking cache validity? If that's the case, then I agree and would be willing to combine them.

Thanks,
Chris
Ross Burton Feb. 18, 2025, 2:28 p.m. UTC | #3
On 18 Feb 2025, at 13:59, chris.laplante@agilent.com wrote:
> Which multiple progress bars are you referring to? Do you mean the separate progress bar for loading cache and checking cache validity? If that's the case, then I agree and would be willing to combine them.

Yes, that’s right.

Ross
chris.laplante@agilent.com Feb. 18, 2025, 2:33 p.m. UTC | #4
> On 18 Feb 2025, at 13:59, chris.laplante@agilent.com wrote:
> > Which multiple progress bars are you referring to? Do you mean the separate
> progress bar for loading cache and checking cache validity? If that's the case,
> then I agree and would be willing to combine them.
> 
> Yes, that's right.

Understood - I'll play around with it. 

Thanks,
Chris
diff mbox series

Patch

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 2fff1b3669..92b1980f5d 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -404,7 +404,8 @@  _evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.Lo
               "bb.event.MultipleProviders", "bb.event.NoProvider", "bb.runqueue.sceneQueueTaskStarted",
               "bb.runqueue.runQueueTaskStarted", "bb.runqueue.runQueueTaskFailed", "bb.runqueue.sceneQueueTaskFailed",
               "bb.event.BuildBase", "bb.build.TaskStarted", "bb.build.TaskSucceeded", "bb.build.TaskFailedSilent",
-              "bb.build.TaskProgress", "bb.event.ProcessStarted", "bb.event.ProcessProgress", "bb.event.ProcessFinished"]
+              "bb.build.TaskProgress", "bb.event.ProcessStarted", "bb.event.ProcessProgress", "bb.event.ProcessFinished",
+              "bb.event.CheckCacheValidityStarted", "bb.event.CheckCacheValidityProgress", "bb.event.CheckCacheValidityCompleted"]

 def drain_events_errorhandling(eventHandler):
     # We don't have logging setup, we do need to show any events we see before exiting
@@ -796,6 +797,26 @@  def main(server, eventHandler, params, tf = TerminalFilter):
                     print("Loaded %d entries from dependency cache." % event.num_entries)
                 continue

+            if isinstance(event, bb.event.CheckCacheValidityStarted):
+                if params.options.quiet > 1:
+                    continue
+                cacheprogress = new_progress("Checking cache validity", event.total).start()
+                continue
+
+            if isinstance(event, bb.event.CheckCacheValidityProgress):
+                if params.options.quiet > 1:
+                    continue
+                cacheprogress.update(event.current)
+                continue
+
+            if isinstance(event, bb.event.CheckCacheValidityCompleted):
+                if params.options.quiet > 1:
+                    continue
+                cacheprogress.finish()
+                if params.options.quiet == 0:
+                    print(f"Checked {event.total:d} cache entries for validity.")
+                continue
+
             if isinstance(event, bb.command.CommandFailed):
                 return_value = event.exitcode
                 if event.error: