Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id B9E82E00D46; Fri, 19 Feb 2016 06:49:28 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.88 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 74F89E00D37 for ; Fri, 19 Feb 2016 06:49:26 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 19 Feb 2016 06:49:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,470,1449561600"; d="scan'208";a="889608460" Received: from cbyrne3-mobl2.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.31.22]) by orsmga001.jf.intel.com with ESMTP; 19 Feb 2016 06:49:25 -0800 From: Elliot Smith To: toaster@yoctoproject.org Date: Fri, 19 Feb 2016 14:49:12 +0000 Message-Id: <1455893353-15024-5-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1455893353-15024-1-git-send-email-elliot.smith@intel.com> References: <1455893353-15024-1-git-send-email-elliot.smith@intel.com> Subject: [PATCH 4/5] toaster: use a more straightforward query to find tasks to update X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2016 14:49:28 -0000 When we get buildstats data for a task (disk IO, CPU usage etc.) we need to find a task already associated with the build and amend its properties with values from that data. The existing code uses an arcane mechanism for locating the task to be updated, which was actually creating duplicate tasks against the build. These tasks were then not displaying in the build's "Tasks" page. Modify how we locate the task in the build which needs to be updated, so that we just filter the existing tasks for the build where the recipe matches the one in the buildstats data. [YOCTO #8842] Signed-off-by: Elliot Smith --- bitbake/lib/bb/ui/buildinfohelper.py | 40 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5f079d1..89e4a08 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -1085,32 +1085,20 @@ class BuildInfoHelper(object): def store_tasks_stats(self, event): task_data = BuildInfoHelper._get_data_from_event(event) - for (taskfile, taskname, taskstats, recipename) in task_data: - localfilepath = taskfile.split(":")[-1] - assert localfilepath.startswith("/") - - recipe_information = self._get_recipe_information_from_taskfile(taskfile) - try: - if recipe_information['file_path'].startswith(recipe_information['layer_version'].local_path): - recipe_information['file_path'] = recipe_information['file_path'][len(recipe_information['layer_version'].local_path):].lstrip("/") - - recipe_object = Recipe.objects.get(layer_version = recipe_information['layer_version'], - file_path__endswith = recipe_information['file_path'], - name = recipename) - except Recipe.DoesNotExist: - logger.error("Could not find recipe for recipe_information %s name %s" , pformat(recipe_information), recipename) - raise - - task_information = {} - task_information['build'] = self.internal_state['build'] - task_information['recipe'] = recipe_object - task_information['task_name'] = taskname - task_information['cpu_usage'] = taskstats['cpu_usage'] - task_information['disk_io'] = taskstats['disk_io'] - if 'elapsed_time' in taskstats: - task_information['elapsed_time'] = taskstats['elapsed_time'] - - self.orm_wrapper.get_update_task_object(task_information, True) + for (taskfile, task_name, taskstats, recipename) in task_data: + # find the task for this build which matches the task information + # we're storing + task_to_update = Task.objects.get( + build = self.internal_state['build'], + recipe__name = recipename, + task_name = task_name + ) + + task_to_update.cpu_usage = taskstats['cpu_usage'] + task_to_update.disk_io = taskstats['disk_io'] + task_to_update.elapsed_time = taskstats['elapsed_time'] + + task_to_update.save() def update_and_store_task(self, event): assert 'taskfile' in vars(event) -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.