[Toaster] [PATCH 3/7] runbuilds: process builds on SIGUSR1

Ed Bartosh ed.bartosh at linux.intel.com
Tue Sep 13 06:21:00 PDT 2016


Run main processing function 'runbuild' only if SIGUSR1 is
received. This signal is sent by Toaster when build status
is changed (either started, cancelled or finished).

This should stop continuous database polling as run_builds function
will be called only when needed, i.e. after build status is changed.

[YOCTO #8918]

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
index a703770..61a520c 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -11,9 +11,9 @@ from orm.models import Build, ToasterSetting, LogMessage, Target
 
 import os
 import logging
-import time
 import sys
 import traceback
+import signal
 
 logger = logging.getLogger("toaster")
 
@@ -175,6 +175,8 @@ class Command(NoArgsCommand):
             logger.warn("runbuilds: schedule exception %s" % str(e))
 
     def handle_noargs(self, **options):
+        signal.signal(signal.SIGUSR1, lambda sig, frame: None)
+
         while True:
+            signal.pause()
             self.runbuild()
-            time.sleep(1)
-- 
2.1.4



More information about the toaster mailing list