From d086fa3aed34a05d52e73c255ca22379149a64a1 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Mon, 20 Jan 2014 09:39:34 +0000 Subject: bitbake: toasterui: add extra debug and development infos We update and add logs throughout the code in order to help with development. The extra logging is turned off by default, but it can be enabled by using environment variables. All logging happens through the Python logging facilities. The toaster UI will save a log of all incoming events if the TOASTER_EVENTLOG variable is set. If TOASTER_SQLDEBUG is set all DB queries will be logged. If TOASTER_DEVEL is set and the django-fresh module is available, the module is enabled to allow auto-reload of pages when the source is changed. (Bitbake rev: 10c27450601b4d24bbb273bd0e053498807d1060) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../lib/toaster/bldcontrol/management/commands/runbuilds.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 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 5e253e0efc..56c989c9c9 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -4,6 +4,9 @@ from orm.models import Build from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdException, BuildSetupException from bldcontrol.models import BuildRequest, BuildEnvironment, BRError import os +import logging + +logger = logging.getLogger("toaster") class Command(NoArgsCommand): args = "" @@ -32,6 +35,7 @@ class Command(NoArgsCommand): # select the build environment and the request to build br = self._selectBuildRequest() except IndexError as e: + # logger.debug("runbuilds: No build request") return try: bec = self._selectBuildEnvironment() @@ -39,10 +43,10 @@ class Command(NoArgsCommand): # we could not find a BEC; postpone the BR br.state = BuildRequest.REQ_QUEUED br.save() - print "No build env" + logger.debug("runbuilds: No build env") return - print "Build %s, Environment %s" % (br, bec.be) + logger.debug("runbuilds: starting build %s, environment %s" % (br, bec.be)) # let the build request know where it is being executed br.environment = bec.be br.save() @@ -63,7 +67,7 @@ class Command(NoArgsCommand): task = None bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all())), task) - print "Build launched, exiting" + logger.debug("runbuilds: Build launched, exiting") # disconnect from the server bbctrl.disconnect() @@ -71,7 +75,7 @@ class Command(NoArgsCommand): except Exception as e: - print " EE Error executing shell command\n", e + logger.error("runbuilds: Error executing shell command %s" % e) traceback.print_exc(e) BRError.objects.create(req = br, errtype = str(type(e)), @@ -83,6 +87,7 @@ class Command(NoArgsCommand): bec.be.save() + def cleanup(self): from django.utils import timezone from datetime import timedelta -- cgit v1.2.3-54-g00ecf