summaryrefslogtreecommitdiffstats
path: root/lib/bb/server/process.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-23 16:16:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 10:39:00 +0100
commitba5a6c88785d9889d4172ec79937ac2a5555327e (patch)
tree8c80c4af65efc8015e162e8b8a3d650befd0c184 /lib/bb/server/process.py
parent8c01cff94787abbb64fbdf0c16cd63f8f97a7e03 (diff)
downloadopenembedded-core-contrib-ba5a6c88785d9889d4172ec79937ac2a5555327e.tar.gz
bitbake: Add ui event handlers filtering
Add functionality to allow UIs to update and change the types of events they recieve. To do this we need to add a new command and also need to be able to obtain the current event hander ID. In the case of xmlrpc, this is straightforward, in the case of the process server we need to save the result in a multiprocessing.Value() so we can retrive it. An excplit command was added to the server API to facilitate this. The same function can also be used to mask or unmask specific log messages, allowing the UI to optionally differ from the standard set of message filtering. Based upon work by Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/process.py')
-rw-r--r--lib/bb/server/process.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 99a6bf55cc..e2cec49b74 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -37,8 +37,9 @@ from . import BitBakeBaseServer, BitBakeBaseServerConnection, BaseImplServer
logger = logging.getLogger('BitBake')
class ServerCommunicator():
- def __init__(self, connection):
+ def __init__(self, connection, event_handle):
self.connection = connection
+ self.event_handle = event_handle
def runCommand(self, command):
# @todo try/except
@@ -54,6 +55,8 @@ class ServerCommunicator():
except KeyboardInterrupt:
pass
+ def getEventHandle(self):
+ return self.event_handle.value
class EventAdapter():
"""
@@ -84,11 +87,12 @@ class ProcessServer(Process, BaseImplServer):
self.keep_running = Event()
self.keep_running.set()
+ self.event_handle = multiprocessing.Value("i")
def run(self):
for event in bb.event.ui_queue:
self.event_queue.put(event)
- self.event_handle = bb.event.register_UIHhandler(self)
+ self.event_handle.value = bb.event.register_UIHhandler(self)
bb.cooker.server_main(self.cooker, self.main)
def main(self):
@@ -106,7 +110,7 @@ class ProcessServer(Process, BaseImplServer):
logger.exception('Running command %s', command)
self.event_queue.close()
- bb.event.unregister_UIHhandler(self.event_handle)
+ bb.event.unregister_UIHhandler(self.event_handle.value)
self.command_channel.close()
self.cooker.stop()
self.idle_commands(.1)
@@ -147,7 +151,7 @@ class BitBakeProcessServerConnection(BitBakeBaseServerConnection):
self.procserver = serverImpl
self.ui_channel = ui_channel
self.event_queue = event_queue
- self.connection = ServerCommunicator(self.ui_channel)
+ self.connection = ServerCommunicator(self.ui_channel, self.procserver.event_handle)
self.events = self.event_queue
def terminate(self):