[Toaster] [PATCH 2/5] toaster: runbuilds move the execution sequence out of the poll loop

Michael Wood michael.g.wood at intel.com
Mon Apr 25 11:04:54 PDT 2016


Move the execution sequence for a build out of the polling loop and into
it's own fuction. This means that we can call the function on it's own
if we just want to trigger one build rather than infinite polling.
This is something needed for the build tests.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
 .../bldcontrol/management/commands/runbuilds.py    | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 27289be..3b34fe0 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -158,22 +158,24 @@ class Command(NoArgsCommand):
             br.environment.lock = BuildEnvironment.LOCK_FREE
             br.environment.save()
 
+    def runbuild(self):
+        try:
+            self.cleanup()
+        except Exception as e:
+            logger.warn("runbuilds: cleanup exception %s" % str(e))
 
-    def handle_noargs(self, **options):
-        while True:
-            try:
-                self.cleanup()
-            except Exception as e:
-                logger.warn("runbuilds: cleanup exception %s" % str(e))
+        try:
+            self.archive()
+        except Exception as e:
+            logger.warn("runbuilds: archive exception %s" % str(e))
 
-            try:
-                self.archive()
-            except Exception as e:
-                logger.warn("runbuilds: archive exception %s" % str(e))
+        try:
+            self.schedule()
+        except Exception as e:
+            logger.warn("runbuilds: schedule exception %s" % str(e))
 
-            try:
-                self.schedule()
-            except Exception as e:
-                logger.warn("runbuilds: schedule exception %s" % str(e))
 
+    def handle_noargs(self, **options):
+        while True:
+            self.runbuild()
             time.sleep(1)
-- 
2.7.4



More information about the toaster mailing list