From 3a439f94ab61902155eecc86c31b2bd6968b0dbe Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Jan 2023 17:43:30 +0000 Subject: bitbake: knotty: Improve shutdown handling There are three levels of shutdown, the initial "wait for current tasks", then "stop current tasks" and "exit now". Change the code so that we don't instantly exit after "stop current tasks" but allow the events to come through from the server first. The new shutdown level allows that to then be broken out of too. (Bitbake rev: af38345b91cfc8a6bb5c38f5753255e7635bfe2b) Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/knotty.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 7370a1adfd..431baa15ef 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -631,7 +631,12 @@ def main(server, eventHandler, params, tf = TerminalFilter): termfilter = tf(main, helper, console_handlers, params.options.quiet) atexit.register(termfilter.finish) - while main.shutdown < 2: + # shutdown levels + # 0 - normal operation + # 1 - no new task execution, let current running tasks finish + # 2 - interrupting currently executing tasks + # 3 - we're done, exit + while main.shutdown < 3: try: if (lastprint + printinterval) <= time.time(): termfilter.keepAlive(printinterval) @@ -644,7 +649,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): termfilter.clearFooter() print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) return_value = 3 - main.shutdown = 2 + main.shutdown = 3 lastevent = time.time() if not parseprogress: termfilter.updateFooter() @@ -756,15 +761,15 @@ def main(server, eventHandler, params, tf = TerminalFilter): if event.error: errors = errors + 1 logger.error(str(event)) - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.command.CommandExit): if not return_value: return_value = event.exitcode - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)): - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.event.MultipleProviders): logger.info(str(event)) -- cgit v1.2.3-54-g00ecf