From 8e70fa1d7933f36244badb34c28ab67f8f159d74 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 28 Oct 2016 18:48:47 +0300 Subject: bitbake: 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. (Bitbake rev: 60d3f93836da5523705b0b2e25567d1c9040ec89) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/toaster/orm/models.py') diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index a7de57c256..9a4db1e856 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/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) -- cgit v1.2.3-54-g00ecf