diff options
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 65e1eab527..b037e0fb6c 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -58,6 +58,7 @@ class ProcessServer(): | |||
58 | self.sockname = sockname | 58 | self.sockname = sockname |
59 | 59 | ||
60 | self.server_timeout = server_timeout | 60 | self.server_timeout = server_timeout |
61 | self.timeout = self.server_timeout | ||
61 | self.xmlrpcinterface = xmlrpcinterface | 62 | self.xmlrpcinterface = xmlrpcinterface |
62 | 63 | ||
63 | def register_idle_function(self, function, data): | 64 | def register_idle_function(self, function, data): |
@@ -72,21 +73,6 @@ class ProcessServer(): | |||
72 | 73 | ||
73 | print("Bitbake XMLRPC server address: %s, server port: %s" % (self.xmlrpc.host, self.xmlrpc.port)) | 74 | print("Bitbake XMLRPC server address: %s, server port: %s" % (self.xmlrpc.host, self.xmlrpc.port)) |
74 | 75 | ||
75 | heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT') | ||
76 | if heartbeat_event: | ||
77 | try: | ||
78 | self.heartbeat_seconds = float(heartbeat_event) | ||
79 | except: | ||
80 | bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event) | ||
81 | |||
82 | self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT') | ||
83 | try: | ||
84 | if self.timeout: | ||
85 | self.timeout = float(self.timeout) | ||
86 | except: | ||
87 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) | ||
88 | |||
89 | |||
90 | try: | 76 | try: |
91 | self.bitbake_lock.seek(0) | 77 | self.bitbake_lock.seek(0) |
92 | self.bitbake_lock.truncate() | 78 | self.bitbake_lock.truncate() |
@@ -129,6 +115,7 @@ class ProcessServer(): | |||
129 | fds = [self.sock] | 115 | fds = [self.sock] |
130 | if self.xmlrpc: | 116 | if self.xmlrpc: |
131 | fds.append(self.xmlrpc) | 117 | fds.append(self.xmlrpc) |
118 | seendata = False | ||
132 | print("Entering server connection loop") | 119 | print("Entering server connection loop") |
133 | 120 | ||
134 | def disconnect_client(self, fds): | 121 | def disconnect_client(self, fds): |
@@ -228,6 +215,22 @@ class ProcessServer(): | |||
228 | if self.xmlrpc in ready: | 215 | if self.xmlrpc in ready: |
229 | self.xmlrpc.handle_requests() | 216 | self.xmlrpc.handle_requests() |
230 | 217 | ||
218 | if not seendata and hasattr(self.cooker, "data"): | ||
219 | heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT') | ||
220 | if heartbeat_event: | ||
221 | try: | ||
222 | self.heartbeat_seconds = float(heartbeat_event) | ||
223 | except: | ||
224 | bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event) | ||
225 | |||
226 | self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT') | ||
227 | try: | ||
228 | if self.timeout: | ||
229 | self.timeout = float(self.timeout) | ||
230 | except: | ||
231 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) | ||
232 | seendata = True | ||
233 | |||
231 | ready = self.idle_commands(.1, fds) | 234 | ready = self.idle_commands(.1, fds) |
232 | 235 | ||
233 | print("Exiting") | 236 | print("Exiting") |
@@ -323,8 +326,9 @@ class ProcessServer(): | |||
323 | self.next_heartbeat += self.heartbeat_seconds | 326 | self.next_heartbeat += self.heartbeat_seconds |
324 | if self.next_heartbeat <= now: | 327 | if self.next_heartbeat <= now: |
325 | self.next_heartbeat = now + self.heartbeat_seconds | 328 | self.next_heartbeat = now + self.heartbeat_seconds |
326 | heartbeat = bb.event.HeartbeatEvent(now) | 329 | if hasattr(self.cooker, "data"): |
327 | bb.event.fire(heartbeat, self.cooker.data) | 330 | heartbeat = bb.event.HeartbeatEvent(now) |
331 | bb.event.fire(heartbeat, self.cooker.data) | ||
328 | if nextsleep and now + nextsleep > self.next_heartbeat: | 332 | if nextsleep and now + nextsleep > self.next_heartbeat: |
329 | # Shorten timeout so that we we wake up in time for | 333 | # Shorten timeout so that we we wake up in time for |
330 | # the heartbeat. | 334 | # the heartbeat. |