From 0b2e6442a6da8d05649530365601f49d37cb6ab5 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Tue, 2 Jun 2015 12:57:03 +0100 Subject: bitbake: toaster: improve the buildenvironment API We improve the buildenvironment API by reducing it to a single command: triggerBuild. This command is specifically implemented in each BE controller type, so the runbuilds management command is only concerned with scheduling the next build, and not with the details of how a build is actually started. (Bitbake rev: 7ee0f1da0a8fcac37419ffdddbe35a9268a1ded4) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../bldcontrol/management/commands/runbuilds.py | 30 +++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py') diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py index 808318f14f..920d9efcd0 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -50,33 +50,16 @@ class Command(NoArgsCommand): # write the build identification variable BRVariable.objects.create(req = br, name="TOASTER_BRBE", value="%d:%d" % (br.pk, bec.be.pk)) + # let the build request know where it is being executed br.environment = bec.be br.save() - # set up the buid environment with the needed layers - bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all()) - bec.writeConfFile("conf/toaster-pre.conf", br.brvariable_set.all()) - bec.writeConfFile("conf/toaster.conf", raw = "INHERIT+=\"toaster buildhistory\"") - - # get the bb server running with the build req id and build env id - bbctrl = bec.getBBController() - - # trigger the build command - task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, br.brtarget_set.all())) - if len(task) == 0: - task = None - bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all())), task) - - logger.debug("runbuilds: Build launched, exiting. Follow build logs at %s/toaster_ui.log" % bec.be.builddir) - # disconnect from the server - bbctrl.disconnect() - - # cleanup to be performed by toaster when the deed is done - + # this triggers an async build + bec.triggerBuild(br.brbitbake_set.all(), br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all()) except Exception as e: - logger.error("runbuilds: Error executing shell command %s" % e) + logger.error("runbuilds: Error launching build %s" % e) traceback.print_exc(e) if "[Errno 111] Connection refused" in str(e): # Connection refused, read toaster_server.out @@ -124,8 +107,9 @@ class Command(NoArgsCommand): def cleanup(self): from django.utils import timezone from datetime import timedelta - # environments locked for more than 30 seconds - they should be unlocked - BuildEnvironment.objects.filter(lock=BuildEnvironment.LOCK_LOCK).filter(updated__lt = timezone.now() - timedelta(seconds = 30)).update(lock = BuildEnvironment.LOCK_FREE) + # DISABLED environments locked for more than 30 seconds - they should be unlocked + #BuildEnvironment.objects.filter(lock=BuildEnvironment.LOCK_LOCK).filter(updated__lt = timezone.now() - timedelta(seconds = 30)).update(lock = BuildEnvironment.LOCK_FREE) + pass def handle_noargs(self, **options): -- cgit v1.2.3-54-g00ecf