diff mbox series

runqueue: Make the "Initialising tasks" progress bar finish properly

Message ID 20250927055339.2472285-1-pkj@axis.com
State New
Headers show
Series runqueue: Make the "Initialising tasks" progress bar finish properly | expand

Commit Message

Peter Kjellerstedt Sept. 27, 2025, 5:53 a.m. UTC
The "Initialising tasks" progress bar needs to be finished before
update_scenequeue_data() creates another progress bar.

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

Comments

Richard Purdie Oct. 9, 2025, 11:48 a.m. UTC | #1
On Sat, 2025-09-27 at 07:53 +0200, Peter Kjellerstedt via lists.openembedded.org wrote:
> The "Initialising tasks" progress bar needs to be finished before
> update_scenequeue_data() creates another progress bar.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  bitbake/lib/bb/runqueue.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
> index 63d4edd892..96d70080d3 100644
> --- a/bitbake/lib/bb/runqueue.py
> +++ b/bitbake/lib/bb/runqueue.py
> @@ -1610,7 +1610,6 @@ class RunQueue:
>  
>          if self.state == RunQueueState.SCENE_INIT:
>              self.start_worker(self.rqexe)
> -            self.rqdata.init_progress_reporter.finish()
>  
>              # If we don't have any setscene functions, skip execution
>              if not self.rqdata.runq_setscene_tids:
> @@ -1948,6 +1947,10 @@ class RunQueueExecute:
>          self.sqdata = SQData()
>          build_scenequeue_data(self.sqdata, self.rqdata, self)
>  
> +        # Finish the "Initialising tasks" progress bar before
> +        # update_scenequeue_data() creates another one.
> +        self.rqdata.init_progress_reporter.finish()
> +
>          update_scenequeue_data(self.sqdata.sq_revdeps, self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=True)
>  
>          # Compute a list of 'stale' sstate tasks where the current hash does not match the one

Having this call buried inside RunQueueExecute is not going to improve
code readability or maintainability.

Also, whilst I agree update_scenequeue_data() *may* trigger a progress
bar update but it is far from clear how it does that. I suspect it does
so via code that is sstate_checkhashes() in sstate.bbclass in OE-Core
but that is metadata dependent, may not always happen and subject to
change totally out of sync with the code in bitbake.

I think the progress bar handling code needs to understand how to run
multiple bars in parallel, or close any existing bars if present when a
new one is triggered.

So I don't think this patch makes sense in this form, sorry.

Cheers,

Richard
Peter Kjellerstedt Oct. 11, 2025, 3:08 a.m. UTC | #2
> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: den 9 oktober 2025 13:48
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-devel@lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH] runqueue: Make the "Initialising tasks" progress bar finish properly
> 
> On Sat, 2025-09-27 at 07:53 +0200, Peter Kjellerstedt via lists.openembedded.org wrote:
> > The "Initialising tasks" progress bar needs to be finished before
> > update_scenequeue_data() creates another progress bar.
> >
> > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > ---
> >  bitbake/lib/bb/runqueue.py | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
> > index 63d4edd892..96d70080d3 100644
> > --- a/bitbake/lib/bb/runqueue.py
> > +++ b/bitbake/lib/bb/runqueue.py
> > @@ -1610,7 +1610,6 @@ class RunQueue:
> >
> >          if self.state == RunQueueState.SCENE_INIT:
> >              self.start_worker(self.rqexe)
> > -            self.rqdata.init_progress_reporter.finish()
> >
> >              # If we don't have any setscene functions, skip execution
> >              if not self.rqdata.runq_setscene_tids:
> > @@ -1948,6 +1947,10 @@ class RunQueueExecute:
> >          self.sqdata = SQData()
> >          build_scenequeue_data(self.sqdata, self.rqdata, self)
> >
> > +        # Finish the "Initialising tasks" progress bar before
> > +        # update_scenequeue_data() creates another one.
> > +        self.rqdata.init_progress_reporter.finish()
> > +
> >          update_scenequeue_data(self.sqdata.sq_revdeps, self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=True)
> >
> >          # Compute a list of 'stale' sstate tasks where the current hash does not match the one
> 
> Having this call buried inside RunQueueExecute is not going to improve
> code readability or maintainability.
> 
> Also, whilst I agree update_scenequeue_data() *may* trigger a progress
> bar update but it is far from clear how it does that. I suspect it does
> so via code that is sstate_checkhashes() in sstate.bbclass in OE-Core
> but that is metadata dependent, may not always happen and subject to
> change totally out of sync with the code in bitbake.
> 
> I think the progress bar handling code needs to understand how to run
> multiple bars in parallel, or close any existing bars if present when a
> new one is triggered.
> 
> So I don't think this patch makes sense in this form, sorry.

And you were of course correct in that assessment. The solution 
proposed above was definitely not the correct way to solve this. 
I have now dug deeper into this, and while I would have loved to 
make a solution that supported multiple progress bars, that would 
only really have been possible with the interactive Knotty UI. 
So in the end I went with a solution that finishes any active 
process progress bar before starting a new.

I will send it along with a couple of minor improvements that I 
made while digging into the code. There is also a small tweak 
needed for sstate.bbclass to avoid the sstate summary from 
potentially overwriting an active progress bar.

> Cheers,
> 
> Richard

//Peter
diff mbox series

Patch

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 63d4edd892..96d70080d3 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1610,7 +1610,6 @@  class RunQueue:
 
         if self.state == RunQueueState.SCENE_INIT:
             self.start_worker(self.rqexe)
-            self.rqdata.init_progress_reporter.finish()
 
             # If we don't have any setscene functions, skip execution
             if not self.rqdata.runq_setscene_tids:
@@ -1948,6 +1947,10 @@  class RunQueueExecute:
         self.sqdata = SQData()
         build_scenequeue_data(self.sqdata, self.rqdata, self)
 
+        # Finish the "Initialising tasks" progress bar before
+        # update_scenequeue_data() creates another one.
+        self.rqdata.init_progress_reporter.finish()
+
         update_scenequeue_data(self.sqdata.sq_revdeps, self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=True)
 
         # Compute a list of 'stale' sstate tasks where the current hash does not match the one