All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] improved killing bitbake server
@ 2016-01-05  8:48 Ed Bartosh
  2016-01-05  8:48 ` [PATCH 1/2] bitbake: xmplrpc: split connect method Ed Bartosh
  2016-01-05  8:48 ` [PATCH " Ed Bartosh
  0 siblings, 2 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05  8:48 UTC (permalink / raw)
  To: bitbake-devel

Hi,

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.

This patchset makes server terminating to work without setting up
the event queue and registering UI handler. This should make
terminating server to work more reliably.

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


Ed Bartosh (2):
  bitbake: xmplrpc: split connect method
  bitbake: main: kill server without queue setup

 bitbake/lib/bb/main.py          | 12 +++++++-----
 bitbake/lib/bb/server/xmlrpc.py |  4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)

--
Regards,
Ed



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

* [PATCH 1/2] bitbake: xmplrpc: split connect method
  2016-01-05  8:48 [PATCH 0/2] improved killing bitbake server Ed Bartosh
@ 2016-01-05  8:48 ` Ed Bartosh
  2016-01-05 15:21   ` Burton, Ross
  2016-01-05  8:48 ` [PATCH " Ed Bartosh
  1 sibling, 1 reply; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05  8:48 UTC (permalink / raw)
  To: bitbake-devel

Current code in connect method sets up event queue, which requires
registering UI handler. This functionality may not be needed for
some operations, e.g. for server termination.

Moved functionality of setting up event queue in from 'connect'
method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.

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 c8530fc..dd04393 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -403,6 +403,7 @@ 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)))
 
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 17eb28b..1ceca51 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -302,7 +302,9 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             return None
 
         self.transport.set_connection_token(token)
+        return self
 
+    def setupEventQueue(self):
         self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo)
         for event in bb.event.ui_queue:
             self.events.queue_event(event)
@@ -314,8 +316,6 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             # no need to log it here, the error shall be sent to the client
             raise BaseException(error)
 
-        return self
-
     def removeClient(self):
         if not self.observer_only:
             self.connection.removeClient()
-- 
2.1.4



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

* [PATCH 2/2] bitbake: main: kill server without queue setup
  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  8:48 ` Ed Bartosh
  1 sibling, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05  8:48 UTC (permalink / raw)
  To: bitbake-devel

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



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

* [PATCH v2 0/2] improved killing bitbake server
  2016-01-05 15:21   ` Burton, Ross
@ 2016-01-05 13:45     ` 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
  0 siblings, 2 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05 13:45 UTC (permalink / raw)
  To: bitbake-devel

Hi,

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.

This patchset makes server terminating to work without setting up
the event queue and registering UI handler. This should make
terminating server to work more reliably.

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

Changes in v2: Fixed AttributeError: BitBakeProcessServerConnection instance has no attribute 'setupEventQueue'

Ed Bartosh (2):
  bitbake: xmplrpc: split connect method
  bitbake: main: kill server without queue setup

 bitbake/lib/bb/main.py            | 12 +++++++-----
 bitbake/lib/bb/server/__init__.py |  3 +++
 bitbake/lib/bb/server/xmlrpc.py   |  4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)

--
Regards,
Ed



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

* [PATCH v2 1/2] bitbake: xmplrpc: split connect method
  2016-01-05 13:45     ` [PATCH v2 0/2] improved killing bitbake server Ed Bartosh
@ 2016-01-05 13:45       ` Ed Bartosh
  2016-01-05 13:45       ` [PATCH v2 2/2] bitbake: main: kill server without queue setup Ed Bartosh
  1 sibling, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05 13:45 UTC (permalink / raw)
  To: bitbake-devel

Current code in connect method sets up event queue, which requires
registering UI handler. This functionality may not be needed for
some operations, e.g. for server termination.

Moved functionality of setting up event queue in from 'connect'
method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.

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 c8530fc..dd04393 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -403,6 +403,7 @@ 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)))
 
diff --git a/bitbake/lib/bb/server/__init__.py b/bitbake/lib/bb/server/__init__.py
index da5e480..538a633 100644
--- a/bitbake/lib/bb/server/__init__.py
+++ b/bitbake/lib/bb/server/__init__.py
@@ -63,6 +63,9 @@ class BitBakeBaseServerConnection():
     def terminate(self):
         pass
 
+    def setupEventQueue(self):
+        pass
+
 
 """ BitBakeBaseServer class is the common ancestor to all Bitbake servers
 
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 17eb28b..1ceca51 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -302,7 +302,9 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             return None
 
         self.transport.set_connection_token(token)
+        return self
 
+    def setupEventQueue(self):
         self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo)
         for event in bb.event.ui_queue:
             self.events.queue_event(event)
@@ -314,8 +316,6 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             # no need to log it here, the error shall be sent to the client
             raise BaseException(error)
 
-        return self
-
     def removeClient(self):
         if not self.observer_only:
             self.connection.removeClient()
-- 
2.1.4



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

* [PATCH v2 2/2] bitbake: main: kill server without queue setup
  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       ` Ed Bartosh
  1 sibling, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-01-05 13:45 UTC (permalink / raw)
  To: bitbake-devel

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



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

* Re: [PATCH 1/2] bitbake: xmplrpc: split connect method
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Burton, Ross @ 2016-01-05 15:21 UTC (permalink / raw)
  To: Ed Bartosh; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

On 5 January 2016 at 08:48, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:

> Moved functionality of setting up event queue in from 'connect'
> method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.
>

Bitbake fails for me now:

Traceback (most recent call last):
 File "/home/ross/Yocto/poky/bitbake/bin/bitbake", line 45, in <module>
   cookerdata.CookerConfiguration()))
 File "/home/ross/Yocto/poky/bitbake/lib/bb/main.py", line 414, in
bitbake_main
   server_connection.setupEventQueue()
AttributeError: BitBakeProcessServerConnection instance has no attribute
'setupEventQueue'

Ross

[-- Attachment #2: Type: text/html, Size: 1118 bytes --]

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

end of thread, other threads:[~2016-01-05 15:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH " 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.