aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/bldcontrol/management/commands/runbuilds.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-06-02 12:57:03 +0100
committerAlexandru DAMIAN <alexandru.damian@intel.com>2015-06-25 11:08:25 +0100
commit7ee0f1da0a8fcac37419ffdddbe35a9268a1ded4 (patch)
tree3325f82353e7bb9453dc5d38433332a963a6a4c2 /lib/toaster/bldcontrol/management/commands/runbuilds.py
parent77d3f7c6cdc7f06807024896369f8f8ae94263fc (diff)
downloadbitbake-contrib-7ee0f1da0a8fcac37419ffdddbe35a9268a1ded4.tar.gz
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. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib/toaster/bldcontrol/management/commands/runbuilds.py')
-rw-r--r--lib/toaster/bldcontrol/management/commands/runbuilds.py30
1 files changed, 7 insertions, 23 deletions
diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 808318f14..920d9efcd 100644
--- a/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/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):