Message ID | 20221229170728.880367-4-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | 6567ad6181f9e39812097f0154647e4b38238fdd |
Headers | show |
Series | Bitbake server thread enabling | expand |
> -----Original Message----- > From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Richard Purdie > Sent: den 29 december 2022 18:07 > To: bitbake-devel@lists.openembedded.org > Subject: [bitbake-devel] [PATCH 03/15] knotty: Ping the server/cooker periodically > > We've seeing failures where the UI hangs if the server disappears. Ping Change " We've seeing" to either "We're seeing" or "We've seen". > the cooker/server if we've not had any events in the last minute so we can > check if it is still alive. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > lib/bb/ui/knotty.py | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py > index 61cf0a37f4..ab1a367be0 100644 > --- a/lib/bb/ui/knotty.py > +++ b/lib/bb/ui/knotty.py > @@ -625,7 +625,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): > > printintervaldelta = 10 * 60 # 10 minutes > printinterval = printintervaldelta > - lastprint = time.time() > + pinginterval = 1 * 60 # 1 minutes Change "1 minutes" to "1 minute". > + lastevent = lastprint = time.time() > > termfilter = tf(main, helper, console_handlers, params.options.quiet) > atexit.register(termfilter.finish) > @@ -637,6 +638,14 @@ def main(server, eventHandler, params, tf = TerminalFilter): > printinterval += printintervaldelta > event = eventHandler.waitEvent(0) > if event is None: > + if (lastevent + pinginterval) <= time.time(): > + ret, error = server.runCommand(["ping"]) > + if error or not ret: > + termfilter.clearFooter() > + print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) > + return_value = 3 > + main.shutdown = 2 > + lastevent = time.time() > if main.shutdown > 1: > break > if not parseprogress: > @@ -644,6 +653,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): > event = eventHandler.waitEvent(0.25) > if event is None: > continue > + lastevent = time.time() > helper.eventHandler(event) > if isinstance(event, bb.runqueue.runQueueExitWait): > if not main.shutdown: > -- > 2.37.2 //Peter
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index 61cf0a37f4..ab1a367be0 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -625,7 +625,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): printintervaldelta = 10 * 60 # 10 minutes printinterval = printintervaldelta - lastprint = time.time() + pinginterval = 1 * 60 # 1 minutes + lastevent = lastprint = time.time() termfilter = tf(main, helper, console_handlers, params.options.quiet) atexit.register(termfilter.finish) @@ -637,6 +638,14 @@ def main(server, eventHandler, params, tf = TerminalFilter): printinterval += printintervaldelta event = eventHandler.waitEvent(0) if event is None: + if (lastevent + pinginterval) <= time.time(): + ret, error = server.runCommand(["ping"]) + if error or not ret: + termfilter.clearFooter() + print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) + return_value = 3 + main.shutdown = 2 + lastevent = time.time() if main.shutdown > 1: break if not parseprogress: @@ -644,6 +653,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): event = eventHandler.waitEvent(0.25) if event is None: continue + lastevent = time.time() helper.eventHandler(event) if isinstance(event, bb.runqueue.runQueueExitWait): if not main.shutdown:
We've seeing failures where the UI hangs if the server disappears. Ping the cooker/server if we've not had any events in the last minute so we can check if it is still alive. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/ui/knotty.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)