From 70c4eb8d3acaad267ee943ebfba793f9cc1c5ee6 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Wed, 17 Jun 2015 17:30:34 +0100 Subject: bitbake: toaster: refactor build model We remove the "timespent", "errors_no" and "warnings_no" fields in favor of computing the needed values at runtime. This prevents inconsistencies in the UI. Also removeing all references to BuildRequests from the interface - all build details now display in the build dashboard. Minor fixes related to data logging. (Bitbake rev: 44f37394ed3e4ca02f940be172fe4395b0ee0f7d) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../lib/toaster/bldcontrol/management/commands/runbuilds.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 bcf3b04cf0..33cc94ea89 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -107,20 +107,24 @@ class Command(NoArgsCommand): def cleanup(self): from django.utils import timezone from datetime import timedelta - # 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) + # environments locked for more than 30 seconds - they should be unlocked + BuildEnvironment.objects.filter(buildrequest__state__in=[BuildRequest.REQ_FAILED, BuildRequest.REQ_COMPLETED]).filter(lock=BuildEnvironment.LOCK_LOCK).filter(updated__lt = timezone.now() - timedelta(seconds = 30)).update(lock = BuildEnvironment.LOCK_FREE) # update all Builds that failed to start for br in BuildRequest.objects.filter(state = BuildRequest.REQ_FAILED, build__outcome = Build.IN_PROGRESS): - br.build.outcome = Build.FAILED # transpose the launch errors in ToasterExceptions + br.build.outcome = Build.FAILED for brerror in br.brerror_set.all(): logger.debug("Saving error %s" % brerror) LogMessage.objects.create(build = br.build, level = LogMessage.EXCEPTION, message = brerror.errmsg) br.build.save() + # we don't have a true build object here; hence, toasterui didn't have a change to release the BE lock + br.environment.lock = BuildEnvironment.LOCK_FREE + br.environment.save() + # update all BuildRequests without a build created -- cgit v1.2.3-54-g00ecf