diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-29 11:08:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-30 11:43:56 +0000 |
commit | 5375e6431c0475b1a266d481af2af5187dbf99f2 (patch) | |
tree | 42ddb49adc97802d38470bd1ad5d440970d3fc2e /bitbake | |
parent | 5b234d1539c26b011a6a68fc583080a75fa02efb (diff) | |
download | poky-5375e6431c0475b1a266d481af2af5187dbf99f2.tar.gz |
bitbake: 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.
(Bitbake rev: 539726a3b2202249a3f148d99e08909cb61902a5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake-worker | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 1 | ||||
-rw-r--r-- | bitbake/lib/prserv/serv.py | 4 |
7 files changed, 18 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 3390f637e3..f053382f50 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -18,7 +18,7 @@ if len(sys.argv) != 2 or not sys.argv[1].startswith("decafbad"): | |||
18 | sys.exit(1) | 18 | sys.exit(1) |
19 | 19 | ||
20 | profiling = False | 20 | profiling = False |
21 | if sys.argv[1] == "decafbadbad": | 21 | if sys.argv[1].startswith("decafbadbad"): |
22 | profiling = True | 22 | profiling = True |
23 | try: | 23 | try: |
24 | import cProfile as profile | 24 | import cProfile as profile |
@@ -202,6 +202,8 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdat | |||
202 | the_data = bb.cache.Cache.loadDataFull(fn, appends, data) | 202 | the_data = bb.cache.Cache.loadDataFull(fn, appends, data) |
203 | the_data.setVar('BB_TASKHASH', workerdata["runq_hash"][task]) | 203 | the_data.setVar('BB_TASKHASH', workerdata["runq_hash"][task]) |
204 | 204 | ||
205 | bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN", True), taskname.replace("do_", ""))) | ||
206 | |||
205 | # exported_vars() returns a generator which *cannot* be passed to os.environ.update() | 207 | # exported_vars() returns a generator which *cannot* be passed to os.environ.update() |
206 | # successfully. We also need to unset anything from the environment which shouldn't be there | 208 | # successfully. We also need to unset anything from the environment which shouldn't be there |
207 | exports = bb.data.exported_vars(the_data) | 209 | exports = bb.data.exported_vars(the_data) |
@@ -296,6 +298,10 @@ class BitbakeWorker(object): | |||
296 | signal.signal(signal.SIGTERM, self.sigterm_exception) | 298 | signal.signal(signal.SIGTERM, self.sigterm_exception) |
297 | # Let SIGHUP exit as SIGTERM | 299 | # Let SIGHUP exit as SIGTERM |
298 | signal.signal(signal.SIGHUP, self.sigterm_exception) | 300 | signal.signal(signal.SIGHUP, self.sigterm_exception) |
301 | if "beef" in sys.argv[1]: | ||
302 | bb.utils.set_process_name("Worker (Fakeroot)") | ||
303 | else: | ||
304 | bb.utils.set_process_name("Worker") | ||
299 | 305 | ||
300 | def sigterm_exception(self, signum, stackframe): | 306 | def sigterm_exception(self, signum, stackframe): |
301 | if signum == signal.SIGTERM: | 307 | if signum == signal.SIGTERM: |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index a02d143c34..a1182ef461 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -2012,6 +2012,7 @@ class CookerParser(object): | |||
2012 | bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) | 2012 | bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) |
2013 | def init(): | 2013 | def init(): |
2014 | Parser.cfg = self.cfgdata | 2014 | Parser.cfg = self.cfgdata |
2015 | bb.utils.set_process_name(multiprocessing.current_process().name) | ||
2015 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cfgdata,), exitpriority=1) | 2016 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cfgdata,), exitpriority=1) |
2016 | multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, args=(self.cfgdata,), exitpriority=1) | 2017 | multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, args=(self.cfgdata,), exitpriority=1) |
2017 | 2018 | ||
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index f840ad2154..2f0a9562d7 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -884,6 +884,7 @@ class RunQueue: | |||
884 | if self.cooker.configuration.profile: | 884 | if self.cooker.configuration.profile: |
885 | magic = "decafbadbad" | 885 | magic = "decafbadbad" |
886 | if fakeroot: | 886 | if fakeroot: |
887 | magic = magic + "beef" | ||
887 | fakerootcmd = self.cfgData.getVar("FAKEROOTCMD", True) | 888 | fakerootcmd = self.cfgData.getVar("FAKEROOTCMD", True) |
888 | fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV", True) or "").split() | 889 | fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV", True) or "").split() |
889 | env = os.environ.copy() | 890 | env = os.environ.copy() |
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 5fca3508b1..1e2b8249a9 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -106,6 +106,7 @@ class ProcessServer(Process, BaseImplServer): | |||
106 | # the UI and communicated to us | 106 | # the UI and communicated to us |
107 | self.quitin.close() | 107 | self.quitin.close() |
108 | signal.signal(signal.SIGINT, signal.SIG_IGN) | 108 | signal.signal(signal.SIGINT, signal.SIG_IGN) |
109 | bb.utils.set_process_name("Cooker") | ||
109 | while not self.quit: | 110 | while not self.quit: |
110 | try: | 111 | try: |
111 | if self.command_channel.poll(): | 112 | if self.command_channel.poll(): |
@@ -212,6 +213,7 @@ class ProcessEventQueue(multiprocessing.queues.Queue): | |||
212 | def __init__(self, maxsize): | 213 | def __init__(self, maxsize): |
213 | multiprocessing.queues.Queue.__init__(self, maxsize) | 214 | multiprocessing.queues.Queue.__init__(self, maxsize) |
214 | self.exit = False | 215 | self.exit = False |
216 | bb.utils.set_process_name("ProcessEQueue") | ||
215 | 217 | ||
216 | def setexit(self): | 218 | def setexit(self): |
217 | self.exit = True | 219 | self.exit = True |
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b42f8eb888..3f2b77b6be 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -272,6 +272,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
272 | logger.addHandler(console) | 272 | logger.addHandler(console) |
273 | logger.addHandler(errconsole) | 273 | logger.addHandler(errconsole) |
274 | 274 | ||
275 | bb.utils.set_process_name("KnottyUI") | ||
276 | |||
275 | if params.options.remote_server and params.options.kill_server: | 277 | if params.options.remote_server and params.options.kill_server: |
276 | server.terminateServer() | 278 | server.terminateServer() |
277 | return | 279 | return |
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index df22e253ca..6b479bfa54 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -104,6 +104,7 @@ class BBUIEventQueue: | |||
104 | def startCallbackHandler(self): | 104 | def startCallbackHandler(self): |
105 | 105 | ||
106 | self.server.timeout = 1 | 106 | self.server.timeout = 1 |
107 | bb.utils.set_process_name("UIEventQueue") | ||
107 | while not self.server.quit: | 108 | while not self.server.quit: |
108 | try: | 109 | try: |
109 | self.server.handle_request() | 110 | self.server.handle_request() |
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py index eafc3aab7b..a4ae229134 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
@@ -79,6 +79,8 @@ class PRServer(SimpleXMLRPCServer): | |||
79 | # 60 iterations between syncs or sync if dirty every ~30 seconds | 79 | # 60 iterations between syncs or sync if dirty every ~30 seconds |
80 | iterations_between_sync = 60 | 80 | iterations_between_sync = 60 |
81 | 81 | ||
82 | bb.utils.set_process_name("PRServ Handler") | ||
83 | |||
82 | while not self.quit: | 84 | while not self.quit: |
83 | try: | 85 | try: |
84 | (request, client_address) = self.requestqueue.get(True, 30) | 86 | (request, client_address) = self.requestqueue.get(True, 30) |
@@ -141,6 +143,8 @@ class PRServer(SimpleXMLRPCServer): | |||
141 | self.quit = False | 143 | self.quit = False |
142 | self.timeout = 0.5 | 144 | self.timeout = 0.5 |
143 | 145 | ||
146 | bb.utils.set_process_name("PRServ") | ||
147 | |||
144 | logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" % | 148 | logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" % |
145 | (self.dbfile, self.host, self.port, str(os.getpid()))) | 149 | (self.dbfile, self.host, self.port, str(os.getpid()))) |
146 | 150 | ||