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>
This commit is contained in:
parent
5b234d1539
commit
5375e6431c
|
@ -18,7 +18,7 @@ if len(sys.argv) != 2 or not sys.argv[1].startswith("decafbad"):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
profiling = False
|
profiling = False
|
||||||
if sys.argv[1] == "decafbadbad":
|
if sys.argv[1].startswith("decafbadbad"):
|
||||||
profiling = True
|
profiling = True
|
||||||
try:
|
try:
|
||||||
import cProfile as profile
|
import cProfile as profile
|
||||||
|
@ -202,6 +202,8 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdat
|
||||||
the_data = bb.cache.Cache.loadDataFull(fn, appends, data)
|
the_data = bb.cache.Cache.loadDataFull(fn, appends, data)
|
||||||
the_data.setVar('BB_TASKHASH', workerdata["runq_hash"][task])
|
the_data.setVar('BB_TASKHASH', workerdata["runq_hash"][task])
|
||||||
|
|
||||||
|
bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN", True), taskname.replace("do_", "")))
|
||||||
|
|
||||||
# exported_vars() returns a generator which *cannot* be passed to os.environ.update()
|
# exported_vars() returns a generator which *cannot* be passed to os.environ.update()
|
||||||
# successfully. We also need to unset anything from the environment which shouldn't be there
|
# successfully. We also need to unset anything from the environment which shouldn't be there
|
||||||
exports = bb.data.exported_vars(the_data)
|
exports = bb.data.exported_vars(the_data)
|
||||||
|
@ -296,6 +298,10 @@ class BitbakeWorker(object):
|
||||||
signal.signal(signal.SIGTERM, self.sigterm_exception)
|
signal.signal(signal.SIGTERM, self.sigterm_exception)
|
||||||
# Let SIGHUP exit as SIGTERM
|
# Let SIGHUP exit as SIGTERM
|
||||||
signal.signal(signal.SIGHUP, self.sigterm_exception)
|
signal.signal(signal.SIGHUP, self.sigterm_exception)
|
||||||
|
if "beef" in sys.argv[1]:
|
||||||
|
bb.utils.set_process_name("Worker (Fakeroot)")
|
||||||
|
else:
|
||||||
|
bb.utils.set_process_name("Worker")
|
||||||
|
|
||||||
def sigterm_exception(self, signum, stackframe):
|
def sigterm_exception(self, signum, stackframe):
|
||||||
if signum == signal.SIGTERM:
|
if signum == signal.SIGTERM:
|
||||||
|
|
|
@ -2012,6 +2012,7 @@ class CookerParser(object):
|
||||||
bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
|
bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
|
||||||
def init():
|
def init():
|
||||||
Parser.cfg = self.cfgdata
|
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.codeparser.parser_cache_save, args=(self.cfgdata,), exitpriority=1)
|
||||||
multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, args=(self.cfgdata,), exitpriority=1)
|
multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, args=(self.cfgdata,), exitpriority=1)
|
||||||
|
|
||||||
|
|
|
@ -884,6 +884,7 @@ class RunQueue:
|
||||||
if self.cooker.configuration.profile:
|
if self.cooker.configuration.profile:
|
||||||
magic = "decafbadbad"
|
magic = "decafbadbad"
|
||||||
if fakeroot:
|
if fakeroot:
|
||||||
|
magic = magic + "beef"
|
||||||
fakerootcmd = self.cfgData.getVar("FAKEROOTCMD", True)
|
fakerootcmd = self.cfgData.getVar("FAKEROOTCMD", True)
|
||||||
fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV", True) or "").split()
|
fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV", True) or "").split()
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
|
|
|
@ -106,6 +106,7 @@ class ProcessServer(Process, BaseImplServer):
|
||||||
# the UI and communicated to us
|
# the UI and communicated to us
|
||||||
self.quitin.close()
|
self.quitin.close()
|
||||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
bb.utils.set_process_name("Cooker")
|
||||||
while not self.quit:
|
while not self.quit:
|
||||||
try:
|
try:
|
||||||
if self.command_channel.poll():
|
if self.command_channel.poll():
|
||||||
|
@ -212,6 +213,7 @@ class ProcessEventQueue(multiprocessing.queues.Queue):
|
||||||
def __init__(self, maxsize):
|
def __init__(self, maxsize):
|
||||||
multiprocessing.queues.Queue.__init__(self, maxsize)
|
multiprocessing.queues.Queue.__init__(self, maxsize)
|
||||||
self.exit = False
|
self.exit = False
|
||||||
|
bb.utils.set_process_name("ProcessEQueue")
|
||||||
|
|
||||||
def setexit(self):
|
def setexit(self):
|
||||||
self.exit = True
|
self.exit = True
|
||||||
|
|
|
@ -272,6 +272,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
||||||
logger.addHandler(console)
|
logger.addHandler(console)
|
||||||
logger.addHandler(errconsole)
|
logger.addHandler(errconsole)
|
||||||
|
|
||||||
|
bb.utils.set_process_name("KnottyUI")
|
||||||
|
|
||||||
if params.options.remote_server and params.options.kill_server:
|
if params.options.remote_server and params.options.kill_server:
|
||||||
server.terminateServer()
|
server.terminateServer()
|
||||||
return
|
return
|
||||||
|
|
|
@ -104,6 +104,7 @@ class BBUIEventQueue:
|
||||||
def startCallbackHandler(self):
|
def startCallbackHandler(self):
|
||||||
|
|
||||||
self.server.timeout = 1
|
self.server.timeout = 1
|
||||||
|
bb.utils.set_process_name("UIEventQueue")
|
||||||
while not self.server.quit:
|
while not self.server.quit:
|
||||||
try:
|
try:
|
||||||
self.server.handle_request()
|
self.server.handle_request()
|
||||||
|
|
|
@ -79,6 +79,8 @@ class PRServer(SimpleXMLRPCServer):
|
||||||
# 60 iterations between syncs or sync if dirty every ~30 seconds
|
# 60 iterations between syncs or sync if dirty every ~30 seconds
|
||||||
iterations_between_sync = 60
|
iterations_between_sync = 60
|
||||||
|
|
||||||
|
bb.utils.set_process_name("PRServ Handler")
|
||||||
|
|
||||||
while not self.quit:
|
while not self.quit:
|
||||||
try:
|
try:
|
||||||
(request, client_address) = self.requestqueue.get(True, 30)
|
(request, client_address) = self.requestqueue.get(True, 30)
|
||||||
|
@ -141,6 +143,8 @@ class PRServer(SimpleXMLRPCServer):
|
||||||
self.quit = False
|
self.quit = False
|
||||||
self.timeout = 0.5
|
self.timeout = 0.5
|
||||||
|
|
||||||
|
bb.utils.set_process_name("PRServ")
|
||||||
|
|
||||||
logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" %
|
logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" %
|
||||||
(self.dbfile, self.host, self.port, str(os.getpid())))
|
(self.dbfile, self.host, self.port, str(os.getpid())))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue