summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-29 11:08:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-29 17:06:23 +0000
commit539726a3b2202249a3f148d99e08909cb61902a5 (patch)
treecbc4c59ce3eaf7e74c4880da04178088ce17d07f /lib
parentfd7f1a94d196b8a3c445e313d9e699b352b1da97 (diff)
downloadbitbake-contrib-539726a3b2202249a3f148d99e08909cb61902a5.tar.gz
bitbake: Set process names to be meaninful
This means that when you view the process tree, the processes have meaningful names, aiding debugging: $ pstree -p 30021 bash(30021)───KnottyUI(115579)───Cooker(115590)─┬─PRServ(115592)───{PRServ Handler}(115593) ├─Worker(115630)───bash:sleep(115631)───run.do_sleep.11(115633)───sleep(115634) └─{ProcessEQueue}(115591) $ pstree -p 30021 bash(30021)───KnottyUI(117319)───Cooker(117330)─┬─Cooker(117335) ├─PRServ(117332)───{PRServ Handler}(117333) ├─Parser-1:2(117336) └─{ProcessEQueue}(117331) Applies to parse threads, PR Server, cooker, the workers and execution threads, working within the 16 character limit as best we can. Needed to tweak the bitbake-worker magic values to tell the workers apart. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/cooker.py1
-rw-r--r--lib/bb/runqueue.py1
-rw-r--r--lib/bb/server/process.py2
-rw-r--r--lib/bb/ui/knotty.py2
-rw-r--r--lib/bb/ui/uievent.py1
-rw-r--r--lib/prserv/serv.py4
6 files changed, 11 insertions, 0 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index a02d143c3..a1182ef46 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2012,6 +2012,7 @@ class CookerParser(object):
bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
def init():
Parser.cfg = self.cfgdata
+ bb.utils.set_process_name(multiprocessing.current_process().name)
multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cfgdata,), exitpriority=1)
multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, args=(self.cfgdata,), exitpriority=1)
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index f840ad215..2f0a9562d 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -884,6 +884,7 @@ class RunQueue:
if self.cooker.configuration.profile:
magic = "decafbadbad"
if fakeroot:
+ magic = magic + "beef"
fakerootcmd = self.cfgData.getVar("FAKEROOTCMD", True)
fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV", True) or "").split()
env = os.environ.copy()
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 5fca3508b..1e2b8249a 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -106,6 +106,7 @@ class ProcessServer(Process, BaseImplServer):
# the UI and communicated to us
self.quitin.close()
signal.signal(signal.SIGINT, signal.SIG_IGN)
+ bb.utils.set_process_name("Cooker")
while not self.quit:
try:
if self.command_channel.poll():
@@ -212,6 +213,7 @@ class ProcessEventQueue(multiprocessing.queues.Queue):
def __init__(self, maxsize):
multiprocessing.queues.Queue.__init__(self, maxsize)
self.exit = False
+ bb.utils.set_process_name("ProcessEQueue")
def setexit(self):
self.exit = True
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b42f8eb88..3f2b77b6b 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -272,6 +272,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
logger.addHandler(console)
logger.addHandler(errconsole)
+ bb.utils.set_process_name("KnottyUI")
+
if params.options.remote_server and params.options.kill_server:
server.terminateServer()
return
diff --git a/lib/bb/ui/uievent.py b/lib/bb/ui/uievent.py
index df22e253c..6b479bfa5 100644
--- a/lib/bb/ui/uievent.py
+++ b/lib/bb/ui/uievent.py
@@ -104,6 +104,7 @@ class BBUIEventQueue:
def startCallbackHandler(self):
self.server.timeout = 1
+ bb.utils.set_process_name("UIEventQueue")
while not self.server.quit:
try:
self.server.handle_request()
diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index eafc3aab7..a4ae22913 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -79,6 +79,8 @@ class PRServer(SimpleXMLRPCServer):
# 60 iterations between syncs or sync if dirty every ~30 seconds
iterations_between_sync = 60
+ bb.utils.set_process_name("PRServ Handler")
+
while not self.quit:
try:
(request, client_address) = self.requestqueue.get(True, 30)
@@ -141,6 +143,8 @@ class PRServer(SimpleXMLRPCServer):
self.quit = False
self.timeout = 0.5
+ bb.utils.set_process_name("PRServ")
+
logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" %
(self.dbfile, self.host, self.port, str(os.getpid())))