diff options
| author | Peter Kjellerstedt <pkj@axis.com> | 2025-10-11 05:11:33 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-13 23:30:31 +0100 |
| commit | 4a1f38dd8db14a4181b78b2a1ad57726bff8acbb (patch) | |
| tree | a95193671155b96d9ac1f88c9462adec3f0f8857 /bitbake/lib | |
| parent | b203f9146e1c5ce38bdc55e93f769a14b8fce6ba (diff) | |
| download | poky-4a1f38dd8db14a4181b78b2a1ad57726bff8acbb.tar.gz | |
bitbake: knotty, uihelper: Remove running_pids and lastpids
* 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.
(Bitbake rev: 562b5bf0be2883144391e7030a9dce6a233802ac)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 5 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/uihelper.py | 3 |
2 files changed, 1 insertions, 7 deletions
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): | |||
| 169 | self.stdinbackup = None | 169 | self.stdinbackup = None |
| 170 | self.interactive = sys.stdout.isatty() | 170 | self.interactive = sys.stdout.isatty() |
| 171 | self.footer_present = False | 171 | self.footer_present = False |
| 172 | self.lastpids = [] | ||
| 173 | self.lasttime = time.time() | 172 | self.lasttime = time.time() |
| 174 | self.quiet = quiet | 173 | self.quiet = quiet |
| 175 | 174 | ||
| @@ -254,7 +253,6 @@ class TerminalFilter(object): | |||
| 254 | return | 253 | return |
| 255 | activetasks = self.helper.running_tasks | 254 | activetasks = self.helper.running_tasks |
| 256 | failedtasks = self.helper.failed_tasks | 255 | failedtasks = self.helper.failed_tasks |
| 257 | runningpids = self.helper.running_pids | ||
| 258 | currenttime = time.time() | 256 | currenttime = time.time() |
| 259 | deltatime = currenttime - self.lasttime | 257 | deltatime = currenttime - self.lasttime |
| 260 | 258 | ||
| @@ -283,7 +281,7 @@ class TerminalFilter(object): | |||
| 283 | self._footer_buf.seek(0) | 281 | self._footer_buf.seek(0) |
| 284 | 282 | ||
| 285 | tasks = [] | 283 | tasks = [] |
| 286 | for t in runningpids: | 284 | for t in activetasks.keys(): |
| 287 | start_time = activetasks[t].get("starttime", None) | 285 | start_time = activetasks[t].get("starttime", None) |
| 288 | if start_time: | 286 | if start_time: |
| 289 | msg = "%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"]) | 287 | msg = "%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"]) |
| @@ -358,7 +356,6 @@ class TerminalFilter(object): | |||
| 358 | content = "%s: %s" % (tasknum, task) | 356 | content = "%s: %s" % (tasknum, task) |
| 359 | print(content, file=self._footer_buf) | 357 | print(content, file=self._footer_buf) |
| 360 | lines = lines + self.getlines(content) | 358 | lines = lines + self.getlines(content) |
| 361 | self.lastpids = runningpids[:] | ||
| 362 | self.lastcount = self.helper.tasknumber_current | 359 | self.lastcount = self.helper.tasknumber_current |
| 363 | 360 | ||
| 364 | # Clear footer and Print buffer. | 361 | # 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: | |||
| 13 | self.needUpdate = False | 13 | self.needUpdate = False |
| 14 | self.running_tasks = {} | 14 | self.running_tasks = {} |
| 15 | # Running PIDs preserves the order tasks were executed in | 15 | # Running PIDs preserves the order tasks were executed in |
| 16 | self.running_pids = [] | ||
| 17 | self.failed_tasks = [] | 16 | self.failed_tasks = [] |
| 18 | self.pidmap = {} | 17 | self.pidmap = {} |
| 19 | self.tasknumber_current = 0 | 18 | self.tasknumber_current = 0 |
| @@ -23,7 +22,6 @@ class BBUIHelper: | |||
| 23 | # PIDs are a bad idea as they can be reused before we process all UI events. | 22 | # PIDs are a bad idea as they can be reused before we process all UI events. |
| 24 | # We maintain a 'fuzzy' match for TaskProgress since there is no other way to match | 23 | # We maintain a 'fuzzy' match for TaskProgress since there is no other way to match |
| 25 | def removetid(pid, tid): | 24 | def removetid(pid, tid): |
| 26 | self.running_pids.remove(tid) | ||
| 27 | del self.running_tasks[tid] | 25 | del self.running_tasks[tid] |
| 28 | if self.pidmap[pid] == tid: | 26 | if self.pidmap[pid] == tid: |
| 29 | del self.pidmap[pid] | 27 | del self.pidmap[pid] |
| @@ -35,7 +33,6 @@ class BBUIHelper: | |||
| 35 | self.running_tasks[tid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } | 33 | self.running_tasks[tid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } |
| 36 | else: | 34 | else: |
| 37 | self.running_tasks[tid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } | 35 | self.running_tasks[tid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } |
| 38 | self.running_pids.append(tid) | ||
| 39 | self.pidmap[event.pid] = tid | 36 | self.pidmap[event.pid] = tid |
| 40 | self.needUpdate = True | 37 | self.needUpdate = True |
| 41 | elif isinstance(event, bb.build.TaskSucceeded): | 38 | elif isinstance(event, bb.build.TaskSucceeded): |
