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/2] bitbake: main: kill server without queue setup
Date: Tue,  5 Jan 2016 10:48:11 +0200	[thread overview]
Message-ID: <1451983692-14842-3-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1451983692-14842-1-git-send-email-ed.bartosh@linux.intel.com>

Setup of event queue includes registering of UI handler.
This operation can fail when cooker is busy. However, there is
no need in registering UI handler for terminating the server.

Moved the call of connection.terminateServer before setting up
of the event queue. This should make terminating server to work
more reliably as it doesn't depend on setting up the event queue
and registering UI handler anymore.

This should also help Toaster backend to restart bitbake server
and observer without getting "Could not register UI event handler"
errors.

[YOCTO #8776]

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

diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index dd04393..c0ae38a 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -403,10 +403,16 @@ def bitbake_main(configParams, configuration):
     if not configParams.server_only:
         try:
             server_connection = server.establishConnection(featureset)
-            server_connection.setupEventQueue()
         except Exception as e:
             bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e)))
 
+        if configParams.kill_server:
+            server_connection.connection.terminateServer()
+            bb.event.ui_queue = []
+            return 0
+
+        server_connection.setupEventQueue()
+
         # Restore the environment in case the UI needs it
         for k in cleanedvars:
             os.environ[k] = cleanedvars[k]
@@ -418,11 +424,6 @@ def bitbake_main(configParams, configuration):
             server_connection.terminate()
             return 0
 
-        if configParams.kill_server:
-            server_connection.connection.terminateServer()
-            bb.event.ui_queue = []
-            return 0
-
         try:
             return ui_module.main(server_connection.connection, server_connection.events, configParams)
         finally:
-- 
2.1.4



      parent reply	other threads:[~2016-01-05 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  8:48 [PATCH 0/2] improved killing bitbake server Ed Bartosh
2016-01-05  8:48 ` [PATCH 1/2] bitbake: xmplrpc: split connect method Ed Bartosh
2016-01-05 15:21   ` Burton, Ross
2016-01-05 13:45     ` [PATCH v2 0/2] improved killing bitbake server Ed Bartosh
2016-01-05 13:45       ` [PATCH v2 1/2] bitbake: xmplrpc: split connect method Ed Bartosh
2016-01-05 13:45       ` [PATCH v2 2/2] bitbake: main: kill server without queue setup Ed Bartosh
2016-01-05  8:48 ` Ed Bartosh [this message]

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=1451983692-14842-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.