bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] runqueue/knotty: Improve UI handling of setscene task counting
@ 2021-09-16 12:15 Richard Purdie
  2021-09-16 22:43 ` [bitbake-devel] " Martin Jansa
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2021-09-16 12:15 UTC (permalink / raw)
  To: bitbake-devel

The recent fixes to merge setscene and normal task accounting in runqueue
fixed some display issues but broke the task numbering of setscene tasks.

Add new accounting methods to the stats structure specifically designed
for setscene. This accounts for the fact that setscene tasks can rerun
multiple times in the build.

Then use the new data in the UI to correctly display the numbers the
user wants to see to understand progress.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/runqueue.py    | 21 ++++++++++++++++++---
 lib/bb/ui/knotty.py   |  2 +-
 lib/bb/ui/uihelper.py |  2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 6ce0ce80f6..10511a09dc 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -85,15 +85,19 @@ class RunQueueStats:
     """
     Holds statistics on the tasks handled by the associated runQueue
     """
-    def __init__(self, total):
+    def __init__(self, total, setscene_total):
         self.completed = 0
         self.skipped = 0
         self.failed = 0
         self.active = 0
+        self.setscene_active = 0
+        self.setscene_covered = 0
+        self.setscene_notcovered = 0
+        self.setscene_total = setscene_total
         self.total = total
 
     def copy(self):
-        obj = self.__class__(self.total)
+        obj = self.__class__(self.total, self.setscene_total)
         obj.__dict__.update(self.__dict__)
         return obj
 
@@ -112,6 +116,13 @@ class RunQueueStats:
     def taskActive(self):
         self.active = self.active + 1
 
+    def updateCovered(self, covered, notcovered):
+        self.setscene_covered = covered
+        self.setscene_notcovered = notcovered
+
+    def updateActiveSetscene(self, active):
+        self.setscene_active = active
+
 # These values indicate the next step due to be run in the
 # runQueue state machine
 runQueuePrepare = 2
@@ -1735,7 +1746,7 @@ class RunQueueExecute:
         self.holdoff_need_update = True
         self.sqdone = False
 
-        self.stats = RunQueueStats(len(self.rqdata.runtaskentries))
+        self.stats = RunQueueStats(len(self.rqdata.runtaskentries), len(self.rqdata.runq_setscene_tids))
 
         for mc in rq.worker:
             rq.worker[mc].pipe.setrunqueueexec(self)
@@ -1786,6 +1797,7 @@ class RunQueueExecute:
             else:
                 self.sq_task_complete(task)
             self.sq_live.remove(task)
+            self.stats.updateActiveSetscene(len(self.sq_live))
         else:
             if status != 0:
                 self.task_fail(task, status, fakerootlog=fakerootlog)
@@ -2087,6 +2099,7 @@ class RunQueueExecute:
             self.build_stamps2.append(self.build_stamps[task])
             self.sq_running.add(task)
             self.sq_live.add(task)
+            self.stats.updateActiveSetscene(len(self.sq_live))
             if self.can_start_task():
                 return True
 
@@ -2462,6 +2475,7 @@ class RunQueueExecute:
                 self.sq_task_failoutright(tid)
 
         if changed:
+            self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered))
             self.holdoff_need_update = True
 
     def scenequeue_updatecounters(self, task, fail=False):
@@ -2495,6 +2509,7 @@ class RunQueueExecute:
                         new.add(dep)
             next = new
 
+        self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered))
         self.holdoff_need_update = True
 
     def sq_task_completeoutright(self, task):
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 65ff2727dc..8df745d130 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -753,7 +753,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
                 continue
 
             if isinstance(event, bb.runqueue.sceneQueueTaskStarted):
-                logger.info("Running setscene task %d of %d (%s)" % (event.stats.completed + event.stats.active + event.stats.failed + 1, event.stats.total, event.taskstring))
+                logger.info("Running setscene task %d of %d (%s)" % (event.stats.setscene_covered + event.stats.setscene_active + event.stats.setscene_notcovered + 1, event.stats.setscene_total, event.taskstring))
                 continue
 
             if isinstance(event, bb.runqueue.runQueueTaskStarted):
diff --git a/lib/bb/ui/uihelper.py b/lib/bb/ui/uihelper.py
index 40c7c5a5ef..52fdae3fec 100644
--- a/lib/bb/ui/uihelper.py
+++ b/lib/bb/ui/uihelper.py
@@ -50,7 +50,7 @@ class BBUIHelper:
             removetid(event.pid, tid)
             self.failed_tasks.append( { 'title' : "%s %s" % (event._package, event._task)})
         elif isinstance(event, bb.runqueue.runQueueTaskStarted) or isinstance(event, bb.runqueue.sceneQueueTaskStarted):
-            self.tasknumber_current = event.stats.completed + event.stats.active + event.stats.failed + 1
+            self.tasknumber_current = event.stats.completed + event.stats.active + event.stats.failed + event.stats.setscene_active + 1
             self.tasknumber_total = event.stats.total
             self.needUpdate = True
         elif isinstance(event, bb.build.TaskProgress):
-- 
2.32.0


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

* Re: [bitbake-devel] [PATCH] runqueue/knotty: Improve UI handling of setscene task counting
  2021-09-16 12:15 [PATCH] runqueue/knotty: Improve UI handling of setscene task counting Richard Purdie
@ 2021-09-16 22:43 ` Martin Jansa
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jansa @ 2021-09-16 22:43 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 5804 bytes --]

Thanks, LGTM

Tested-by: Martin Jansa <Martin.Jansa@gmail.com>

On Thu, Sep 16, 2021 at 2:15 PM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> The recent fixes to merge setscene and normal task accounting in runqueue
> fixed some display issues but broke the task numbering of setscene tasks.
>
> Add new accounting methods to the stats structure specifically designed
> for setscene. This accounts for the fact that setscene tasks can rerun
> multiple times in the build.
>
> Then use the new data in the UI to correctly display the numbers the
> user wants to see to understand progress.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/runqueue.py    | 21 ++++++++++++++++++---
>  lib/bb/ui/knotty.py   |  2 +-
>  lib/bb/ui/uihelper.py |  2 +-
>  3 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
> index 6ce0ce80f6..10511a09dc 100644
> --- a/lib/bb/runqueue.py
> +++ b/lib/bb/runqueue.py
> @@ -85,15 +85,19 @@ class RunQueueStats:
>      """
>      Holds statistics on the tasks handled by the associated runQueue
>      """
> -    def __init__(self, total):
> +    def __init__(self, total, setscene_total):
>          self.completed = 0
>          self.skipped = 0
>          self.failed = 0
>          self.active = 0
> +        self.setscene_active = 0
> +        self.setscene_covered = 0
> +        self.setscene_notcovered = 0
> +        self.setscene_total = setscene_total
>          self.total = total
>
>      def copy(self):
> -        obj = self.__class__(self.total)
> +        obj = self.__class__(self.total, self.setscene_total)
>          obj.__dict__.update(self.__dict__)
>          return obj
>
> @@ -112,6 +116,13 @@ class RunQueueStats:
>      def taskActive(self):
>          self.active = self.active + 1
>
> +    def updateCovered(self, covered, notcovered):
> +        self.setscene_covered = covered
> +        self.setscene_notcovered = notcovered
> +
> +    def updateActiveSetscene(self, active):
> +        self.setscene_active = active
> +
>  # These values indicate the next step due to be run in the
>  # runQueue state machine
>  runQueuePrepare = 2
> @@ -1735,7 +1746,7 @@ class RunQueueExecute:
>          self.holdoff_need_update = True
>          self.sqdone = False
>
> -        self.stats = RunQueueStats(len(self.rqdata.runtaskentries))
> +        self.stats = RunQueueStats(len(self.rqdata.runtaskentries),
> len(self.rqdata.runq_setscene_tids))
>
>          for mc in rq.worker:
>              rq.worker[mc].pipe.setrunqueueexec(self)
> @@ -1786,6 +1797,7 @@ class RunQueueExecute:
>              else:
>                  self.sq_task_complete(task)
>              self.sq_live.remove(task)
> +            self.stats.updateActiveSetscene(len(self.sq_live))
>          else:
>              if status != 0:
>                  self.task_fail(task, status, fakerootlog=fakerootlog)
> @@ -2087,6 +2099,7 @@ class RunQueueExecute:
>              self.build_stamps2.append(self.build_stamps[task])
>              self.sq_running.add(task)
>              self.sq_live.add(task)
> +            self.stats.updateActiveSetscene(len(self.sq_live))
>              if self.can_start_task():
>                  return True
>
> @@ -2462,6 +2475,7 @@ class RunQueueExecute:
>                  self.sq_task_failoutright(tid)
>
>          if changed:
> +            self.stats.updateCovered(len(self.scenequeue_covered),
> len(self.scenequeue_notcovered))
>              self.holdoff_need_update = True
>
>      def scenequeue_updatecounters(self, task, fail=False):
> @@ -2495,6 +2509,7 @@ class RunQueueExecute:
>                          new.add(dep)
>              next = new
>
> +        self.stats.updateCovered(len(self.scenequeue_covered),
> len(self.scenequeue_notcovered))
>          self.holdoff_need_update = True
>
>      def sq_task_completeoutright(self, task):
> diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
> index 65ff2727dc..8df745d130 100644
> --- a/lib/bb/ui/knotty.py
> +++ b/lib/bb/ui/knotty.py
> @@ -753,7 +753,7 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
>                  continue
>
>              if isinstance(event, bb.runqueue.sceneQueueTaskStarted):
> -                logger.info("Running setscene task %d of %d (%s)" %
> (event.stats.completed + event.stats.active + event.stats.failed + 1,
> event.stats.total, event.taskstring))
> +                logger.info("Running setscene task %d of %d (%s)" %
> (event.stats.setscene_covered + event.stats.setscene_active +
> event.stats.setscene_notcovered + 1, event.stats.setscene_total,
> event.taskstring))
>                  continue
>
>              if isinstance(event, bb.runqueue.runQueueTaskStarted):
> diff --git a/lib/bb/ui/uihelper.py b/lib/bb/ui/uihelper.py
> index 40c7c5a5ef..52fdae3fec 100644
> --- a/lib/bb/ui/uihelper.py
> +++ b/lib/bb/ui/uihelper.py
> @@ -50,7 +50,7 @@ class BBUIHelper:
>              removetid(event.pid, tid)
>              self.failed_tasks.append( { 'title' : "%s %s" %
> (event._package, event._task)})
>          elif isinstance(event, bb.runqueue.runQueueTaskStarted) or
> isinstance(event, bb.runqueue.sceneQueueTaskStarted):
> -            self.tasknumber_current = event.stats.completed +
> event.stats.active + event.stats.failed + 1
> +            self.tasknumber_current = event.stats.completed +
> event.stats.active + event.stats.failed + event.stats.setscene_active + 1
>              self.tasknumber_total = event.stats.total
>              self.needUpdate = True
>          elif isinstance(event, bb.build.TaskProgress):
> --
> 2.32.0
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 7076 bytes --]

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

end of thread, other threads:[~2021-09-16 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 12:15 [PATCH] runqueue/knotty: Improve UI handling of setscene task counting Richard Purdie
2021-09-16 22:43 ` [bitbake-devel] " Martin Jansa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).