summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-01-14 12:35:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-27 21:01:03 +0000
commit731a0ac2c8ee7f09c24e30b01ac6e3aeaeb1fd08 (patch)
tree95e31f60da5a68d5c2032296ce4450f8c6d9f8db /bitbake
parent3e1dbed33822dd949336022bc155cc5435719b38 (diff)
downloadpoky-731a0ac2c8ee7f09c24e30b01ac6e3aeaeb1fd08.tar.gz
bitbake: toaster: update Task classification fields
This patch updates the task classification fields (outcome, etc) as to * Changes outcome names from SSTATE to CACHED and from EXISTING to PREBUILT * NoExec tasks now recorded as Not Executed / script type NA instead of Executed / script type NOEXEC. Script type NOEXEC is deleted. * SetScene tasks do not get order numbers * New task method that returns a QuerySet for setscene tasks related to this task: Task.get_related_setscene() * New custom TaskManager that allows searching for setscene tasks related to a certain task: Task.objects.related_setscene(task) (Bitbake rev: a4164821a142f8b625a5fdc209adc6dc80874241) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py19
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/simple_task.html8
-rw-r--r--bitbake/lib/toaster/bldviewer/views.py2
-rw-r--r--bitbake/lib/toaster/orm/models.py22
4 files changed, 34 insertions, 17 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 3d5f1c8609..b90e915a1a 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -91,9 +91,9 @@ class ORMWrapper(object):
91 for v in vars(task_object): 91 for v in vars(task_object):
92 if v in task_information.keys(): 92 if v in task_information.keys():
93 vars(task_object)[v] = task_information[v] 93 vars(task_object)[v] = task_information[v]
94 # if we got covered by a setscene task, we're SSTATE 94 # if we got covered by a setscene task, we're CACHED
95 if task_object.outcome == Task.OUTCOME_COVERED and 1 == Task.objects.filter(task_executed=True, build = task_object.build, recipe = task_object.recipe, task_name=task_object.task_name+"_setscene").count(): 95 if task_object.outcome == Task.OUTCOME_COVERED and 1 == Task.objects.related_setscene(task_object).count():
96 task_object.outcome = Task.OUTCOME_SSTATE 96 task_object.outcome = Task.OUTCOME_CACHED
97 outcome_task_setscene = Task.objects.get(task_executed=True, build = task_object.build, 97 outcome_task_setscene = Task.objects.get(task_executed=True, build = task_object.build,
98 recipe = task_object.recipe, task_name=task_object.task_name+"_setscene").outcome 98 recipe = task_object.recipe, task_name=task_object.task_name+"_setscene").outcome
99 if outcome_task_setscene == Task.OUTCOME_SUCCESS: 99 if outcome_task_setscene == Task.OUTCOME_SUCCESS:
@@ -442,14 +442,19 @@ class BuildInfoHelper(object):
442 if event.reason == "covered": 442 if event.reason == "covered":
443 task_information['outcome'] = Task.OUTCOME_COVERED 443 task_information['outcome'] = Task.OUTCOME_COVERED
444 if event.reason == "existing": 444 if event.reason == "existing":
445 task_information['outcome'] = Task.OUTCOME_EXISTING 445 task_information['outcome'] = Task.OUTCOME_PREBUILT
446 else: 446 else:
447 task_information['task_executed'] = True 447 task_information['task_executed'] = True
448 if 'noexec' in vars(event) and event.noexec == True: 448 if 'noexec' in vars(event) and event.noexec == True:
449 task_information['script_type'] = Task.CODING_NOEXEC 449 task_information['task_executed'] = False
450 task_information['outcome'] = Task.OUTCOME_NA
451 task_information['script_type'] = Task.CODING_NA
452
453 # do not assign order numbers to scene tasks
454 if not isinstance(event, bb.runqueue.sceneQueueTaskStarted):
455 self.task_order += 1
456 task_information['order'] = self.task_order
450 457
451 self.task_order += 1
452 task_information['order'] = self.task_order
453 task_obj = self.orm_wrapper.get_update_task_object(task_information) 458 task_obj = self.orm_wrapper.get_update_task_object(task_information)
454 459
455 self.internal_state[identifier] = {'start_time': datetime.datetime.now()} 460 self.internal_state[identifier] = {'start_time': datetime.datetime.now()}
diff --git a/bitbake/lib/toaster/bldviewer/templates/simple_task.html b/bitbake/lib/toaster/bldviewer/templates/simple_task.html
index cb6f309fef..a5ed5295ea 100644
--- a/bitbake/lib/toaster/bldviewer/templates/simple_task.html
+++ b/bitbake/lib/toaster/bldviewer/templates/simple_task.html
@@ -33,11 +33,15 @@
33 {% if task.task_executed %} 33 {% if task.task_executed %}
34 <td>Executed</td> 34 <td>Executed</td>
35 {% else %} 35 {% else %}
36 <td>Prebuilt</td> 36 <td>Not Executed</td>
37 {% endif %} 37 {% endif %}
38 38
39 <td>{{task.sstate_checksum}}</td> 39 <td>{{task.sstate_checksum}}</td>
40 <td>{{task.get_outcome_display}}{% if task.provider %}</br>(by <a href="#{{task.provider.recipe.name}}.{{task.provider.task_name}}">{{task.provider.recipe.name}}.{{task.provider.task_name}}</a>){% endif %}</td> 40 <td>{{task.get_outcome_display}}{% if task.provider %}</br>(by <a href="#{{task.provider.recipe.name}}.{{task.provider.task_name}}">{{task.provider.recipe.name}}.{{task.provider.task_name}}</a>){% endif %}
41 {% if task.outcome == task.OUTCOME_CACHED %}{% for t in task.get_related_setscene %}
42 <br/>({{t.task_name}} {{t.get_outcome_display}})
43 {% endfor %}{%endif%}
44 </td>
41 <td><p>{{task.message}}</td> 45 <td><p>{{task.message}}</td>
42 <td>{{task.elapsed_time}}</td> 46 <td>{{task.elapsed_time}}</td>
43 <td>{{task.cpu_usage}}</td> 47 <td>{{task.cpu_usage}}</td>
diff --git a/bitbake/lib/toaster/bldviewer/views.py b/bitbake/lib/toaster/bldviewer/views.py
index 22b42d39ce..6a90ed7b5a 100644
--- a/bitbake/lib/toaster/bldviewer/views.py
+++ b/bitbake/lib/toaster/bldviewer/views.py
@@ -84,7 +84,7 @@ def _find_task_provider(task):
84def task(request, build_id): 84def task(request, build_id):
85 template = 'simple_task.html' 85 template = 'simple_task.html'
86 86
87 tasks = _build_page_range(Paginator(Task.objects.filter(build=build_id), 100),request.GET.get('page', 1)) 87 tasks = _build_page_range(Paginator(Task.objects.filter(build=build_id, order__gt=0), 100),request.GET.get('page', 1))
88 88
89 for t in tasks: 89 for t in tasks:
90 if t.outcome == Task.OUTCOME_COVERED: 90 if t.outcome == Task.OUTCOME_COVERED:
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index ff26c7d436..7c439487e9 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -60,6 +60,11 @@ class Target(models.Model):
60 return self.target 60 return self.target
61 61
62 62
63
64class TaskManager(models.Manager):
65 def related_setscene(self, task_object):
66 return Task.objects.filter(task_executed=True, build = task_object.build, recipe = task_object.recipe, task_name=task_object.task_name+"_setscene")
67
63class Task(models.Model): 68class Task(models.Model):
64 69
65 SSTATE_NA = 0 70 SSTATE_NA = 0
@@ -75,38 +80,41 @@ class Task(models.Model):
75 ) 80 )
76 81
77 CODING_NA = 0 82 CODING_NA = 0
78 CODING_NOEXEC = 1
79 CODING_PYTHON = 2 83 CODING_PYTHON = 2
80 CODING_SHELL = 3 84 CODING_SHELL = 3
81 85
82 TASK_CODING = ( 86 TASK_CODING = (
83 (CODING_NA, 'N/A'), 87 (CODING_NA, 'N/A'),
84 (CODING_NOEXEC, 'NoExec'),
85 (CODING_PYTHON, 'Python'), 88 (CODING_PYTHON, 'Python'),
86 (CODING_SHELL, 'Shell'), 89 (CODING_SHELL, 'Shell'),
87 ) 90 )
88 91
89 OUTCOME_SUCCESS = 0 92 OUTCOME_SUCCESS = 0
90 OUTCOME_COVERED = 1 93 OUTCOME_COVERED = 1
91 OUTCOME_SSTATE = 2 94 OUTCOME_CACHED = 2
92 OUTCOME_EXISTING = 3 95 OUTCOME_PREBUILT = 3
93 OUTCOME_FAILED = 4 96 OUTCOME_FAILED = 4
94 OUTCOME_NA = 5 97 OUTCOME_NA = 5
95 98
96 TASK_OUTCOME = ( 99 TASK_OUTCOME = (
97 (OUTCOME_SUCCESS, 'Succeeded'), 100 (OUTCOME_SUCCESS, 'Succeeded'),
98 (OUTCOME_COVERED, 'Covered'), 101 (OUTCOME_COVERED, 'Covered'),
99 (OUTCOME_SSTATE, 'Sstate'), 102 (OUTCOME_CACHED, 'Cached'),
100 (OUTCOME_EXISTING, 'Existing'), 103 (OUTCOME_PREBUILT, 'Prebuilt'),
101 (OUTCOME_FAILED, 'Failed'), 104 (OUTCOME_FAILED, 'Failed'),
102 (OUTCOME_NA, 'Not Available'), 105 (OUTCOME_NA, 'Not Available'),
103 ) 106 )
104 107
105 search_allowed_fields = [ "recipe__name", "task_name" ] 108 search_allowed_fields = [ "recipe__name", "task_name" ]
106 109
110 objects = TaskManager()
111
112 def get_related_setscene(self):
113 return Task.objects.related_setscene(self)
114
107 build = models.ForeignKey(Build, related_name='task_build') 115 build = models.ForeignKey(Build, related_name='task_build')
108 order = models.IntegerField(null=True) 116 order = models.IntegerField(null=True)
109 task_executed = models.BooleanField(default=False) # True means Executed, False means Prebuilt 117 task_executed = models.BooleanField(default=False) # True means Executed, False means Not/Executed
110 outcome = models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA) 118 outcome = models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)
111 sstate_checksum = models.CharField(max_length=100, blank=True) 119 sstate_checksum = models.CharField(max_length=100, blank=True)
112 path_to_sstate_obj = models.FilePathField(max_length=500, blank=True) 120 path_to_sstate_obj = models.FilePathField(max_length=500, blank=True)