diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-24 13:44:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-24 16:57:14 +0100 |
commit | 76ecfa5f69429371167cdaf3e4e3a24d8ee77ac3 (patch) | |
tree | 768a514eab9a12e263e1eb872e927c2db13c4fc7 | |
parent | 57196bc6e4a07f855b3073b6120211ddda179077 (diff) | |
download | poky-76ecfa5f69429371167cdaf3e4e3a24d8ee77ac3.tar.gz |
bitbake: 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.
(Bitbake rev: c0ddde7cf680225127d6285685652b905ed176c3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 22 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 22 |
2 files changed, 21 insertions, 23 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 1625d3c158..d6e6919506 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1585,28 +1585,6 @@ class BBCooker: | |||
1585 | self.databuilder.reset() | 1585 | self.databuilder.reset() |
1586 | self.data = self.databuilder.data | 1586 | self.data = self.databuilder.data |
1587 | 1587 | ||
1588 | def server_main(cooker, func, *args): | ||
1589 | cooker.pre_serve() | ||
1590 | |||
1591 | if cooker.configuration.profile: | ||
1592 | try: | ||
1593 | import cProfile as profile | ||
1594 | except: | ||
1595 | import profile | ||
1596 | prof = profile.Profile() | ||
1597 | |||
1598 | ret = profile.Profile.runcall(prof, func, *args) | ||
1599 | |||
1600 | prof.dump_stats("profile.log") | ||
1601 | bb.utils.process_profilelog("profile.log") | ||
1602 | print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed") | ||
1603 | |||
1604 | else: | ||
1605 | ret = func(*args) | ||
1606 | |||
1607 | cooker.post_serve() | ||
1608 | |||
1609 | return ret | ||
1610 | 1588 | ||
1611 | class CookerExit(bb.event.Event): | 1589 | class CookerExit(bb.event.Event): |
1612 | """ | 1590 | """ |
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 01d9f2f014..85beaae014 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -103,9 +103,27 @@ class ProcessServer(multiprocessing.Process): | |||
103 | except: | 103 | except: |
104 | pass | 104 | pass |
105 | 105 | ||
106 | bb.cooker.server_main(self.cooker, self.main) | 106 | if self.cooker.configuration.profile: |
107 | try: | ||
108 | import cProfile as profile | ||
109 | except: | ||
110 | import profile | ||
111 | prof = profile.Profile() | ||
112 | |||
113 | ret = profile.Profile.runcall(prof, self.main) | ||
114 | |||
115 | prof.dump_stats("profile.log") | ||
116 | bb.utils.process_profilelog("profile.log") | ||
117 | print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed") | ||
118 | |||
119 | else: | ||
120 | ret = self.main() | ||
121 | |||
122 | return ret | ||
107 | 123 | ||
108 | def main(self): | 124 | def main(self): |
125 | self.cooker.pre_serve() | ||
126 | |||
109 | bb.utils.set_process_name("Cooker") | 127 | bb.utils.set_process_name("Cooker") |
110 | 128 | ||
111 | ready = [] | 129 | ready = [] |
@@ -184,6 +202,8 @@ class ProcessServer(multiprocessing.Process): | |||
184 | except: | 202 | except: |
185 | pass | 203 | pass |
186 | 204 | ||
205 | self.cooker.post_serve() | ||
206 | |||
187 | # Remove the socket file so we don't get any more connections to avoid races | 207 | # Remove the socket file so we don't get any more connections to avoid races |
188 | os.unlink(self.sockname) | 208 | os.unlink(self.sockname) |
189 | self.sock.close() | 209 | self.sock.close() |