knotty: display active tasks when printing keepAlive() message
PATCH 1/2 knotty: display active tasks when printing keepAlive() message
From: Ross Burton <[email protected]>
In interactive bitbake sessions it is obvious what tasks are running when one of them hangs or otherwise takes a long time. However, in non-interactive sessions (such as automated builds) bitbake just prints a message saying that it is "still alive" with no clues as to what tasks are active still.
By simply listing the active tasks when printing the keep alive message, we don't need to parse the bitbake log to identify which of the tasks is still active and has presumably hung.
--- bitbake/lib/bb/ui/knotty.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/knotty.py +3 -1
@@ -228,7 +228,9 @@ class TerminalFilter(object): def keepAlive(self, t): if not self.cuu: - print("Bitbake still alive (%ds)" % t) + print("Bitbake still alive (no events for %ds). Active tasks:" % t) + for t in self.helper.running_tasks: + print(t) sys.stdout.flush() def updateFooter(self):
PATCH 2/2 knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes
From: Ross Burton <[email protected]>
The keep alive timeout is excessively long at 83 minutes (5000 seconds), reduce this to 10 minutes: this should be long enough that it rarely triggers in normal builds, but when it does it has useful information.
--- bitbake/lib/bb/ui/knotty.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
bitbake/lib/bb/ui/knotty.py +4 -3
@@ -607,7 +607,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): warnings = 0 taskfailures = [] - printinterval = 5000 + printintervaldelta = 10 * 60 # 10 minutes + printinterval = printintervaldelta lastprint = time.time() termfilter = tf(main, helper, console_handlers, params.options.quiet)
@@ -617,7 +618,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): try: if (lastprint + printinterval) <= time.time(): termfilter.keepAlive(printinterval) - printinterval += 5000 + printinterval += printintervaldelta event = eventHandler.waitEvent(0) if event is None: if main.shutdown > 1:
@@ -648,7 +649,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): if isinstance(event, logging.LogRecord): lastprint = time.time() - printinterval = 5000 + printinterval = printintervaldelta if event.levelno >= bb.msg.BBLogFormatter.ERROR: errors = errors + 1 return_value = 1