[oe-commits] [bitbake] 02/02: cooker/process: Drop server_main function
git at git.openembedded.org
git at git.openembedded.org
Mon Jul 24 13:00:39 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit c0ddde7cf680225127d6285685652b905ed176c3
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Mon Jul 24 13:44:05 2017 +0100
cooker/process: Drop server_main function
Now that there is only one server, this abstraction is no longer needed
and causes indrection/confusion. The server shutdown is also broken with
the cooker post_server calls happening too late, leading to "lock held"
warnings in the logs if PRServ is enabled.
Remove the abstraction and put the shutdown calls in the right order
with respect to the locking.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/cooker.py | 22 ----------------------
lib/bb/server/process.py | 22 +++++++++++++++++++++-
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 1625d3c..d6e6919 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1585,28 +1585,6 @@ class BBCooker:
self.databuilder.reset()
self.data = self.databuilder.data
-def server_main(cooker, func, *args):
- cooker.pre_serve()
-
- if cooker.configuration.profile:
- try:
- import cProfile as profile
- except:
- import profile
- prof = profile.Profile()
-
- ret = profile.Profile.runcall(prof, func, *args)
-
- prof.dump_stats("profile.log")
- bb.utils.process_profilelog("profile.log")
- print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed")
-
- else:
- ret = func(*args)
-
- cooker.post_serve()
-
- return ret
class CookerExit(bb.event.Event):
"""
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 01d9f2f..85beaae 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -103,9 +103,27 @@ class ProcessServer(multiprocessing.Process):
except:
pass
- bb.cooker.server_main(self.cooker, self.main)
+ if self.cooker.configuration.profile:
+ try:
+ import cProfile as profile
+ except:
+ import profile
+ prof = profile.Profile()
+
+ ret = profile.Profile.runcall(prof, self.main)
+
+ prof.dump_stats("profile.log")
+ bb.utils.process_profilelog("profile.log")
+ print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed")
+
+ else:
+ ret = self.main()
+
+ return ret
def main(self):
+ self.cooker.pre_serve()
+
bb.utils.set_process_name("Cooker")
ready = []
@@ -184,6 +202,8 @@ class ProcessServer(multiprocessing.Process):
except:
pass
+ self.cooker.post_serve()
+
# Remove the socket file so we don't get any more connections to avoid races
os.unlink(self.sockname)
self.sock.close()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list