diff mbox series

[1/3] knotty, uihelper: Remove running_pids and lastpids

Message ID 20251011031135.2243358-1-pkj@axis.com
State New
Headers show
Series [1/3] knotty, uihelper: Remove running_pids and lastpids | expand

Commit Message

Peter Kjellerstedt Oct. 11, 2025, 3:11 a.m. UTC
* lastpids has not been used for almost 10 years.
* There is no longer any need to use running_pids to keep track of the
  order the pids in running_tasks were added as dicts are guaranteed to
  remember the insertion order since Python 3.7.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/lib/bb/ui/knotty.py   | 5 +----
 bitbake/lib/bb/ui/uihelper.py | 3 ---
 2 files changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 492ea20763..00258c80ff 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -169,7 +169,6 @@  class TerminalFilter(object):
         self.stdinbackup = None
         self.interactive = sys.stdout.isatty()
         self.footer_present = False
-        self.lastpids = []
         self.lasttime = time.time()
         self.quiet = quiet
 
@@ -254,7 +253,6 @@  class TerminalFilter(object):
             return
         activetasks = self.helper.running_tasks
         failedtasks = self.helper.failed_tasks
-        runningpids = self.helper.running_pids
         currenttime = time.time()
         deltatime = currenttime - self.lasttime
 
@@ -283,7 +281,7 @@  class TerminalFilter(object):
         self._footer_buf.seek(0)
 
         tasks = []
-        for t in runningpids:
+        for t in activetasks.keys():
             start_time = activetasks[t].get("starttime", None)
             if start_time:
                 msg = "%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"])
@@ -358,7 +356,6 @@  class TerminalFilter(object):
                     content = "%s: %s" % (tasknum, task)
                     print(content, file=self._footer_buf)
                 lines = lines + self.getlines(content)
-        self.lastpids = runningpids[:]
         self.lastcount = self.helper.tasknumber_current
 
         # Clear footer and Print buffer.
diff --git a/bitbake/lib/bb/ui/uihelper.py b/bitbake/lib/bb/ui/uihelper.py
index e6983bd559..a223632471 100644
--- a/bitbake/lib/bb/ui/uihelper.py
+++ b/bitbake/lib/bb/ui/uihelper.py
@@ -13,7 +13,6 @@  class BBUIHelper:
         self.needUpdate = False
         self.running_tasks = {}
         # Running PIDs preserves the order tasks were executed in
-        self.running_pids = []
         self.failed_tasks = []
         self.pidmap = {}
         self.tasknumber_current = 0
@@ -23,7 +22,6 @@  class BBUIHelper:
         # PIDs are a bad idea as they can be reused before we process all UI events.
         # We maintain a 'fuzzy' match for TaskProgress since there is no other way to match
         def removetid(pid, tid):
-            self.running_pids.remove(tid)
             del self.running_tasks[tid]
             if self.pidmap[pid] == tid:
                 del self.pidmap[pid]
@@ -35,7 +33,6 @@  class BBUIHelper:
                 self.running_tasks[tid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid }
             else:
                 self.running_tasks[tid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid }
-            self.running_pids.append(tid)
             self.pidmap[event.pid] = tid
             self.needUpdate = True
         elif isinstance(event, bb.build.TaskSucceeded):