From: Elliot Smith <elliot.smith@intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH 4/5] toaster: use a more straightforward query to find tasks to update
Date: Fri, 19 Feb 2016 14:49:12 +0000 [thread overview]
Message-ID: <1455893353-15024-5-git-send-email-elliot.smith@intel.com> (raw)
In-Reply-To: <1455893353-15024-1-git-send-email-elliot.smith@intel.com>
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 <elliot.smith@intel.com>
---
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.
next prev parent reply other threads:[~2016-02-19 14:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 14:49 [PATCH 0/5] Fix task buildstats gathering Elliot Smith
2016-02-19 14:49 ` [PATCH 1/5] toaster.bbclass: improve how we gather buildstats for Toaster Elliot Smith
2016-02-19 14:49 ` [PATCH 2/5] toaster: elapsed time for a task is calculated in toaster.bbclass Elliot Smith
2016-02-19 14:49 ` [PATCH 3/5] toaster: when updating task stats, task must exist Elliot Smith
2016-02-19 14:49 ` Elliot Smith [this message]
2016-02-19 14:49 ` [PATCH 5/5] toaster: clarify the units used for buildstats Elliot Smith
2016-02-20 18:51 ` [PATCH 0/5] Fix task buildstats gathering Barros Pena, Belen
2016-02-21 11:04 ` Richard Purdie
2016-02-22 10:25 ` Barros Pena, Belen
2016-02-22 11:12 ` Richard Purdie
2016-02-22 12:25 ` Barros Pena, Belen
2016-02-22 16:51 ` Smith, Elliot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455893353-15024-5-git-send-email-elliot.smith@intel.com \
--to=elliot.smith@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.