[oe-commits] [bitbake] 01/01: bb/tinfoil: run_command handle busy status in bitbake server

git at git.openembedded.org git at git.openembedded.org
Fri Jul 21 10:13:37 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 c75990aa8c13305d0f3efeaa817fdc6fc563eb98
Author: Aníbal Limón <anibal.limon at linux.intel.com>
AuthorDate: Wed Jul 5 15:02:46 2017 -0500

    bb/tinfoil: run_command handle busy status in bitbake server
    
    When tinfoil request a command to bitbake is handled in async
    manner [1], sometimes is this ends on return a Busy status.
    
    This is a workaround a needs to be fixed in proper manner
    inside bitbake code.
    
    For example when running clientComplete and buildFile is on progress,
    
      ERROR: Function failed: base_do_unpack
      Traceback (most recent call last):
        File "/home/alimon/repos/poky/scripts/lib/devtool/standard.py", line
      797, in modify
          initial_rev = _extract_source(srctree, args.keep_temp, args.branch,
      False, rd, tinfoil)
        File "/home/alimon/repos/poky/scripts/lib/devtool/standard.py", line
      562, in _extract_source
          runtask(fn, 'unpack')
        File "/home/alimon/repos/poky/scripts/lib/devtool/standard.py", line
      552, in runtask
          raise DevtoolError('Task do_%s failed' % task)
      devtool.DevtoolError: Task do_unpack failed
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "/home/alimon/repos/poky/scripts/devtool", line 351, in <module>
          ret = main()
        File "/home/alimon/repos/poky/scripts/devtool", line 338, in main
          ret = args.func(args, config, basepath, workspace)
        File "/home/alimon/repos/poky/scripts/lib/devtool/standard.py", line
      864, in modify
          tinfoil.shutdown()
        File "/home/alimon/repos/poky/bitbake/lib/bb/tinfoil.py", line 427, in
      shutdown
          self.run_command('clientComplete')
        File "/home/alimon/repos/poky/bitbake/lib/bb/tinfoil.py", line 320, in
      run_command
          raise TinfoilCommandFailed(result[1])
      bb.tinfoil.TinfoilCommandFailed: Busy (buildFile in progress)
    
    Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/tinfoil.py | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index e246b3d..fea8915 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -22,6 +22,7 @@ import os
 import sys
 import atexit
 import re
+import time
 from collections import OrderedDict, defaultdict
 
 import bb.cache
@@ -444,7 +445,7 @@ class Tinfoil:
         self.run_actions(config_params)
         self.recipes_parsed = True
 
-    def run_command(self, command, *params):
+    def run_command(self, command, *params, ntries=0):
         """
         Run a command on the server (as implemented in bb.command).
         Note that there are two types of command - synchronous and
@@ -461,9 +462,22 @@ class Tinfoil:
         commandline = [command]
         if params:
             commandline.extend(params)
-        result = self.server_connection.connection.runCommand(commandline)
-        if result[1]:
-            raise TinfoilCommandFailed(result[1])
+
+        # XXX: Tinfoil commands are run by Cooker in async mode so gives
+        # some time to get done.
+        result = None
+        while True:
+            result = self.server_connection.connection.runCommand(commandline)
+            if not result[1]:
+                break
+
+            if ntries == 0:
+                raise TinfoilCommandFailed(result[1])
+            elif 'Busy' in result[1]:
+                ntries = ntries - 1
+                time.sleep(1)
+                continue
+
         return result[0]
 
     def set_event_mask(self, eventlist):
@@ -805,7 +819,7 @@ class Tinfoil:
         the tinfoil object which will ensure that it gets called.
         """
         if self.server_connection:
-            self.run_command('clientComplete')
+            self.run_command('clientComplete', ntries=1)
             _server_connections.remove(self.server_connection)
             bb.event.ui_queue = []
             self.server_connection.terminate()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list