[oe-commits] [bitbake] 08/16: toaster: implement signal_runbuilds function

git at git.openembedded.org git at git.openembedded.org
Tue Sep 20 14:28:10 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 62955224a6d99e9f581d2bef924058070bfa4c43
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Fri Sep 16 17:22:29 2016 +0100

    toaster: implement signal_runbuilds function
    
    This function reads pid of runbuilds process from
    BUILDDIR/.runbuilds.pid and sends SIGUSR1 to it. signal_runbuilds
    function will be used in Toaster code to notify runbuilds when
    build is scheduled, finished or cancelled.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Michael Wood <michael.g.wood at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/orm/models.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 8ee0c87..38d014a 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -33,9 +33,10 @@ from django.conf import settings
 import django.db.models.signals
 
 import sys
-import os.path
+import os
 import re
 import itertools
+from signal import SIGUSR1
 
 import logging
 logger = logging.getLogger("toaster")
@@ -1736,6 +1737,11 @@ def invalidate_cache(**kwargs):
     except Exception as e:
       logger.warning("Problem with cache backend: Failed to clear cache: %s" % e)
 
+def signal_runbuilds():
+    """Send SIGUSR1 to runbuilds process"""
+    with open(os.path.join(os.getenv('BUILDDIR'), '.runbuilds.pid')) as pidf:
+        os.kill(int(pidf.read()), SIGUSR1)
+
 django.db.models.signals.post_save.connect(invalidate_cache)
 django.db.models.signals.post_delete.connect(invalidate_cache)
 django.db.models.signals.m2m_changed.connect(invalidate_cache)

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


More information about the Openembedded-commits mailing list