summaryrefslogtreecommitdiffstats
path: root/lib/bb/server/process.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-24 14:57:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-24 17:48:12 +0100
commit3caa43b665604475d2c87ba505efb0b9fca9c2e9 (patch)
tree26e05c7017d6ff25193193341ea0631d7eda4dd1 /lib/bb/server/process.py
parentf7d2c9116116659ea42260a3bb96dca100aadae7 (diff)
downloadbitbake-3caa43b665604475d2c87ba505efb0b9fca9c2e9.tar.gz
cooker: Defer configuration init to after UI connection
Currently we end up parsing the base configuration multiple times as initially, the right settings haven't come from the UI. We can defer this until later in startup using runCommand as a trigger. The advantage to doing this is improved startup times and ultimately we should be able to avoid the double parse of the base configuration. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/process.py')
-rw-r--r--lib/bb/server/process.py38
1 files changed, 21 insertions, 17 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 65e1eab52..b037e0fb6 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -58,6 +58,7 @@ class ProcessServer():
self.sockname = sockname
self.server_timeout = server_timeout
+ self.timeout = self.server_timeout
self.xmlrpcinterface = xmlrpcinterface
def register_idle_function(self, function, data):
@@ -72,21 +73,6 @@ class ProcessServer():
print("Bitbake XMLRPC server address: %s, server port: %s" % (self.xmlrpc.host, self.xmlrpc.port))
- heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT')
- if heartbeat_event:
- try:
- self.heartbeat_seconds = float(heartbeat_event)
- except:
- bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event)
-
- self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT')
- try:
- if self.timeout:
- self.timeout = float(self.timeout)
- except:
- bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
-
-
try:
self.bitbake_lock.seek(0)
self.bitbake_lock.truncate()
@@ -129,6 +115,7 @@ class ProcessServer():
fds = [self.sock]
if self.xmlrpc:
fds.append(self.xmlrpc)
+ seendata = False
print("Entering server connection loop")
def disconnect_client(self, fds):
@@ -228,6 +215,22 @@ class ProcessServer():
if self.xmlrpc in ready:
self.xmlrpc.handle_requests()
+ if not seendata and hasattr(self.cooker, "data"):
+ heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT')
+ if heartbeat_event:
+ try:
+ self.heartbeat_seconds = float(heartbeat_event)
+ except:
+ bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event)
+
+ self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT')
+ try:
+ if self.timeout:
+ self.timeout = float(self.timeout)
+ except:
+ bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
+ seendata = True
+
ready = self.idle_commands(.1, fds)
print("Exiting")
@@ -323,8 +326,9 @@ class ProcessServer():
self.next_heartbeat += self.heartbeat_seconds
if self.next_heartbeat <= now:
self.next_heartbeat = now + self.heartbeat_seconds
- heartbeat = bb.event.HeartbeatEvent(now)
- bb.event.fire(heartbeat, self.cooker.data)
+ if hasattr(self.cooker, "data"):
+ heartbeat = bb.event.HeartbeatEvent(now)
+ bb.event.fire(heartbeat, self.cooker.data)
if nextsleep and now + nextsleep > self.next_heartbeat:
# Shorten timeout so that we we wake up in time for
# the heartbeat.