summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-10-28 18:48:47 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-04 12:50:29 +0000
commit60d3f93836da5523705b0b2e25567d1c9040ec89 (patch)
tree0904c1ec76c65808adbb682167d929cd33e54810
parent4b89db30af25da5f2c519cf684655d5af99f0e2c (diff)
downloadopenembedded-core-contrib-60d3f93836da5523705b0b2e25567d1c9040ec89.tar.gz
toaster: orm models Handle run builds process not yet running
During tests we may want to call the runbuilds process manually for example when doing a "one shot" approach rather than a long running process during tests. Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/toaster/orm/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index a7de57c256..9a4db1e856 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -1741,8 +1741,12 @@ def invalidate_cache(**kwargs):
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)
+ try:
+ with open(os.path.join(os.getenv('BUILDDIR'),
+ '.runbuilds.pid')) as pidf:
+ os.kill(int(pidf.read()), SIGUSR1)
+ except FileNotFoundError:
+ logger.info("Stopping existing runbuilds: no current process found")
django.db.models.signals.post_save.connect(invalidate_cache)
django.db.models.signals.post_delete.connect(invalidate_cache)