All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 2/4] uievent: add error to registerEventHandler return
Date: Thu, 31 Dec 2015 18:42:14 +0200	[thread overview]
Message-ID: <1451580136-29714-3-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1451580136-29714-1-git-send-email-ed.bartosh@linux.intel.com>

Current code throws Exception("Could not register UI event handler")
if event handler can't be registered. The real reason of this is that
cooker is in busy state. Error message lacks information about this.

Added error message to the return value of registerEventHandler.
Included returned error message into the log message and exception
text.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>

diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index b7647c1..17eb28b 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -97,10 +97,10 @@ class BitBakeServerCommands():
 
         # we don't allow connections if the cooker is running
         if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]):
-            return None
+            return None, "Cooker is busy: %s" % bb.cooker.state.get_name(self.cooker.state)
 
         self.event_handle = bb.event.register_UIHhandler(s, True)
-        return self.event_handle
+        return self.event_handle, 'OK'
 
     def unregisterEventHandler(self, handlerNum):
         """
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index 7fc50c7..80686a6 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -52,19 +52,21 @@ class BBUIEventQueue:
         # giving up
 
         while self.EventHandler == None and count_tries < 5:
-            self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
+            self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port)
 
             if (self.EventHandle != None):
                 break
 
-            bb.warn("Could not register UI event handler %s:%d, retry" % (self.host, self.port))
+            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:
-            raise Exception("Could not register UI event handler")
+            raise Exception(errmsg)
 
         self.server = server
 
-- 
2.1.4



  parent reply	other threads:[~2015-12-31 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ed Bartosh [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451580136-29714-3-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.