@@ -60,7 +60,7 @@ class Command:
# FIXME Add lock for this
self.currentAsyncCommand = None
- def runCommand(self, commandline, ro_only = False):
+ def runCommand(self, commandline, process_server, ro_only = False):
command = commandline.pop(0)
# Ensure cooker is ready for commands
@@ -100,7 +100,11 @@ class Command:
else:
return result, None
if self.currentAsyncCommand is not None:
- return None, "Busy (%s in progress)" % self.currentAsyncCommand[0]
+ # Wait for the idle loop to have cleared (30s max)
+ process_server.is_idle.clear()
+ process_server.is_idle.wait(timeout=30)
+ if self.currentAsyncCommand is not None:
+ return None, "Busy (%s in progress)" % self.currentAsyncCommand[0]
if command not in CommandsAsync.__dict__:
return None, "No such command"
self.currentAsyncCommand = (command, commandline)
@@ -260,7 +260,7 @@ class ProcessServer():
continue
try:
serverlog("Running command %s" % command)
- self.command_channel_reply.send(self.cooker.command.runCommand(command))
+ self.command_channel_reply.send(self.cooker.command.runCommand(command, self))
serverlog("Command Completed (socket: %s)" % os.path.exists(self.sockname))
except Exception as e:
stack = traceback.format_exc()
@@ -118,7 +118,7 @@ class BitBakeXMLRPCServerCommands():
"""
Run a cooker command on the server
"""
- return self.server.cooker.command.runCommand(command, self.server.readonly)
+ return self.server.cooker.command.runCommand(command, self.server, self.server.readonly)
def getEventHandle(self):
return self.event_handle
When running a new async command, the previous one might not have finished executing in the idle handler. Add some code to use the event logic to wait for the idle loop to finish for 30s before saying the server is busy. This avoids build failures when a UI quickly starts the next async command before the code has finished shutdown/cleanup from the last one. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/command.py | 8 ++++++-- lib/bb/server/process.py | 2 +- lib/bb/server/xmlrpcserver.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-)