[bitbake-devel] [PATCH 1/2] toasterui: improvements in data reading

Alex DAMIAN alexandru.damian at intel.com
Fri Oct 31 19:17:01 UTC 2014


From: Alexandru DAMIAN <alexandru.damian at intel.com>

We add improvements in data reading, following
issues discovered in testing.

- elapsed_time is now read from buildstats
- we add safeguards to not fail logging if the build was triggered
with a toaster_brbe configuration, but it's running in
1.6 mode
- added log markups for build finish to let other programs
known when the work is done.

[YOCTO #6833]
[YOCTO #6685]
[YOCTO #6887]

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 lib/bb/ui/buildinfohelper.py | 22 +++++++++++++---------
 lib/bb/ui/toasterui.py       |  6 ++++--
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index fcef53b..b5ae9e97 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -67,13 +67,15 @@ class ORMWrapper(object):
 
         if brbe is not None:
             from bldcontrol.models import BuildEnvironment, BuildRequest
-            br, be = brbe.split(":")
-            buildrequest = BuildRequest.objects.get(pk = br)
-            buildrequest.build = build
-            buildrequest.save()
-            build.project_id = buildrequest.project_id
-            build.save()
-
+            try:
+                br, be = brbe.split(":")
+                buildrequest = BuildRequest.objects.get(pk = br)
+                buildrequest.build = build
+                buildrequest.save()
+                build.project_id = buildrequest.project_id
+                build.save()
+            except BuildRequest.DoesNotExist:
+                pass
         return build
 
     def create_target_objects(self, target_info):
@@ -146,6 +148,8 @@ class ORMWrapper(object):
         if 'start_time' in task_information.keys() and 'end_time' in task_information.keys():
             duration = task_information['end_time'] - task_information['start_time']
             task_object.elapsed_time = duration
+            del task_information['start_time']
+            del task_information['end_time']
 
         task_object.save()
         return task_object
@@ -320,8 +324,7 @@ class ORMWrapper(object):
                 searchname = pkgpnmap[p]['OPKGN']
 
             packagedict[p]['object'], created = Package.objects.get_or_create( build = build_obj, name = searchname )
-            if created:
-                # package was not build in the current build, but
+            if True:    # save the data anyway we can, not just if it was not created here; bug [YOCTO #6887]
                 # fill in everything we can from the runtime-reverse package data
                 try:
                     packagedict[p]['object'].recipe = recipes[pkgpnmap[p]['PN']]
@@ -717,6 +720,7 @@ class BuildInfoHelper(object):
             task_information['task_name'] = taskname
             task_information['cpu_usage'] = taskstats['cpu_usage']
             task_information['disk_io'] = taskstats['disk_io']
+            task_information['elapsed_time'] = taskstats['elapsed_time']
             task_obj = self.orm_wrapper.get_update_task_object(task_information, True)  # must exist
 
     def update_and_store_task(self, event):
diff --git a/lib/bb/ui/toasterui.py b/lib/bb/ui/toasterui.py
index 0c53843..007c6b6 100644
--- a/lib/bb/ui/toasterui.py
+++ b/lib/bb/ui/toasterui.py
@@ -231,14 +231,16 @@ def main(server, eventHandler, params ):
 
                 buildinfohelper.update_build_information(event, errors, warnings, taskfailures)
                 buildinfohelper.close(errorcode)
+                # mark the log output; controllers may kill the toasterUI after seeing this log
+                logger.info("ToasterUI build done")
 
                 # we start a new build info
                 if buildinfohelper.brbe is not None:
 
-                    print "we are under BuildEnvironment management - after the build, we exit"
+                    logger.debug(1, "ToasterUI under BuildEnvironment management - exiting after the build")
                     server.terminateServer()
                 else:
-                    print "prepared for new build"
+                    logger.debug(1, "ToasterUI prepared for new build")
                     errors = 0
                     warnings = 0
                     taskfailures = []
-- 
1.9.1



More information about the bitbake-devel mailing list