All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Improve error reporting for registerEventHandler
@ 2015-12-31 16:42 Ed Bartosh
  2015-12-31 16:42 ` [PATCH 1/4] cooker: add state.get_name method Ed Bartosh
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-12-31 16:42 UTC (permalink / raw)
  To: bitbake-devel

Hi,

This patchset includes refactoring changes for the code that deals
with registering UI event handlers. It improves error reporting
and cleans up the code a bit.

Ed Bartosh (4):
  cooker: add state.get_name method
  uievent: add error to registerEventHandler return
  uievent: get rid of EventHandler attribute
  uievent: refactor retry loop

 bitbake/lib/bb/cooker.py        |  8 ++++++++
 bitbake/lib/bb/server/xmlrpc.py |  4 ++--
 bitbake/lib/bb/ui/uievent.py    | 22 +++++++++++-----------
 3 files changed, 21 insertions(+), 13 deletions(-)

--
Regards,
Ed



^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH v2] uievent: refactor retry loop
@ 2016-01-04  8:12 Ed Bartosh
  2016-01-04  8:20 ` Ed Bartosh
  0 siblings, 1 reply; 10+ messages in thread
From: Ed Bartosh @ 2016-01-04  8:12 UTC (permalink / raw)
  To: openembedded-core; +Cc: CABcZANkw_e36yhZgTVcMdVO5fm7=B4UoN-ZxjKOzNOQTvf3-1g

Replaced 'while' loop with 'for' loop.
Made the code more compact and hopefully more understandable.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/uievent.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index 19a9301..af239a3 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -45,27 +45,25 @@ class BBUIEventQueue:
         server.socket.settimeout(1)
 
         self.EventHandle = None
-        count_tries = 0
 
         # the event handler registration may fail here due to cooker being in invalid state
         # this is a transient situation, and we should retry a couple of times before
         # giving up
 
-        while self.EventHandle == None and count_tries < 5:
+        for count_tries in range(5):
+
             self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port)
 
-            if (self.EventHandle != None):
+            if self.EventHandle != None:
                 break
 
             errmsg = "Could not register UI event handler. Error: %s, host %s, "
                      "port %d" % (error, self.host, self.port))
             bb.warn("%s, retry" % errmsg)
-            count_tries += 1
+
             import time
             time.sleep(1)
-
-
-        if self.EventHandle == None:
+        else:
             raise Exception(errmsg)
 
         self.server = server
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-04 11:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-31 16:42 [PATCH 0/4] Improve error reporting for registerEventHandler Ed Bartosh
2015-12-31 16:42 ` [PATCH 1/4] cooker: add state.get_name method Ed Bartosh
2015-12-31 16:42 ` [PATCH 2/4] uievent: add error to registerEventHandler return Ed Bartosh
2015-12-31 16:42 ` [PATCH 3/4] uievent: get rid of EventHandler attribute Ed Bartosh
2015-12-31 16:42 ` [PATCH 4/4] uievent: refactor retry loop Ed Bartosh
2016-01-02 19:29   ` Christopher Larson
2016-01-04  8:14     ` [PATCH v2] " Ed Bartosh
2016-01-04  9:26       ` [PATCH 4/4 v3] " Ed Bartosh
  -- strict thread matches above, loose matches on Subject: below --
2016-01-04  8:12 [PATCH v2] " Ed Bartosh
2016-01-04  8:20 ` Ed Bartosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.