summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRavi Chintakunta <ravi.chintakunta@timesys.com>2014-02-17 23:30:41 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 12:24:00 -0700
commit31d4bf8484ee42690386c6b7a6bd6c7a2be54464 (patch)
treeb9ef1f8c22dc51445c9ba6a35f05e091262a47b2 /bitbake/lib
parent2bd19cd02623b7c5494c2f7057587252a75746c9 (diff)
downloadpoky-31d4bf8484ee42690386c6b7a6bd6c7a2be54464.tar.gz
bitbake: toaster: View detailed information about a task
Information about a task is displayed depending on it's execution status and outcome status. Edited to iterate through all possible entries for related setscene tasks. [YOCTO #4282] (Bitbake rev: 62f502b1237d4060df6be1ee4f4865db5fa39a6a) Signed-off-by: Ravi Chintakunta <ravi.chintakunta@timesys.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/orm/models.py12
-rw-r--r--bitbake/lib/toaster/toastergui/templates/task.html263
-rw-r--r--bitbake/lib/toaster/toastergui/templates/tasks.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py8
-rw-r--r--bitbake/lib/toaster/toastergui/views.py34
5 files changed, 315 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 588e1b9265..abc16d9b88 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -111,6 +111,15 @@ class Task(models.Model):
111 (OUTCOME_EMPTY, 'Empty'), 111 (OUTCOME_EMPTY, 'Empty'),
112 ) 112 )
113 113
114 TASK_OUTCOME_HELP = {
115 OUTCOME_SUCCESS:'This task completed successfully',
116 OUTCOME_COVERED:'This task did not run because its output is provided by another task',
117 OUTCOME_CACHED:'This task restored output from the sstate-cache directory or mirrors',
118 OUTCOME_PREBUILT:'This task did not run because its outcome was reused from a previous build',
119 OUTCOME_FAILED:'This task did not complete',
120 OUTCOME_NA:''
121 }
122
114 search_allowed_fields = [ "recipe__name", "recipe__version", "task_name", "logfile" ] 123 search_allowed_fields = [ "recipe__name", "recipe__version", "task_name", "logfile" ]
115 124
116 objects = TaskManager() 125 objects = TaskManager()
@@ -118,6 +127,9 @@ class Task(models.Model):
118 def get_related_setscene(self): 127 def get_related_setscene(self):
119 return Task.objects.related_setscene(self) 128 return Task.objects.related_setscene(self)
120 129
130 def outcome_help(self):
131 return Task.TASK_OUTCOME_HELP[self.outcome]
132
121 def get_executed_display(self): 133 def get_executed_display(self):
122 if self.task_executed: 134 if self.task_executed:
123 return "Executed" 135 return "Executed"
diff --git a/bitbake/lib/toaster/toastergui/templates/task.html b/bitbake/lib/toaster/toastergui/templates/task.html
new file mode 100644
index 0000000000..c5d6176b62
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/task.html
@@ -0,0 +1,263 @@
1{% extends "basebuilddetailpage.html" %}
2
3{% load projecttags %}
4{% load humanize %}
5
6{% block localbreadcrumb %}
7<li><a href="{% url 'tasks' build.pk %}">Tasks</a></li>
8<li>{{task.recipe.name}}_{{task.recipe.version}} {{task.task_name}}</li>
9{% endblock %}
10
11{% block pagedetailinfomain %}
12
13<div class="row span11">
14 <div class="page-header">
15 <h1><a href="{%url 'recipe' build.pk task.recipe.pk %}">{{task.recipe.name}}_{{task.recipe.version}}</a> {{task.task_name}}</h1>
16 </div>
17
18{# Outcome section #}
19<h2 {{ task|task_color:True }}>
20 {{task.get_outcome_display}}
21 <i class="icon-question-sign get-help heading-help" title="" data-original-title="{{task.outcome_help}}"></i>
22</h2>
23{%if task.task_executed %}
24 {# executed tasks outcome #}
25 <dl class="dl-horizontal">
26 <dt>
27 <i class="icon-question-sign get-help" title="" data-original-title="The location in disk of the task log file"></i> Log file
28 </dt>
29 <dd>
30 <code>{{task.logfile}}</code>
31 </dd>
32 {# show stack trace for failed task #}
33 {% if task.outcome == task.OUTCOME_FAILED and log_head %}
34 <h3>Python stack trace</h3>
35 <div>
36 <pre style="min-height:160px;">
37 <code>{{log_head}}</code><a id="full-trace-show" data-target="#fulltrace" data-toggle="collapse" class="btn btn-mini">...</a>
38 <div id="fulltrace" class="collapse" style="margin-top: -20px; height: 0px;">
39 <code>{{log_body}}</code><br><a id="full-trace-hide" class="btn btn-mini collapsed" style="font-family:Helvetica Neue" data-target="#fulltrace" data-toggle="collapse">Collapse stack trace<i class="icon-caret-up"></i></a></div></pre>
40 </div>
41 {% endif %}
42 </dl>
43{% else %}
44{# not executed tasks outcome #}
45 {% if task.outcome == task.OUTCOME_PREBUILT %}
46 {% if not showing_matches %}
47 <a class="btn" href="javascript:reload_params({'show_matches' : 'true' })">Match to tasks in previous builds <i class="icon-question-sign get-help" style="margin-top:20px;" data-toggle="tooltip" title="This will show you a list of tasks from previous builds with the same inputs signature as this prebuilt task. Any of them could be the task that generated the output this prebuilt task is reusing"></i></a>
48 {% elif matching_tasks %}
49 <h3 class="details">Prebuilt task could be based on
50 <i class="icon-question-sign get-help heading-help" title="" data-toggle="tooltip" data-original-title="This table shows a list of tasks from previous builds with the same inputs signature as the prebuilt task. Any of them could be the task that generated the output the prebuilt task is reusing"></i>
51 </h3>
52 <table class="table table-bordered table-hover">
53 <thead>
54 <th>
55 <i class="icon-question-sign get-help" title="The name of the recipe to which each task applies"></i>
56 Recipe
57 </th>
58 <th>
59 <i class="icon-question-sign get-help" title="The name of the task"></i>
60 Task
61 </th>
62 <th>
63 <i class="icon-question-sign get-help" title="This value tells you if a task had to run in order to generate the task output (executed), or if the output was provided by another task and therefore the task didn't need to run (not executed)"></i>
64 Executed
65 </th>
66 <th>
67 <i class="icon-question-sign get-help" title="This column tells you if executed tasks succeeded, failed or reused output from the sstate-cache directory or mirrors. It also tells you why not executed tasks did not need to run"></i>
68 Outcome
69 </th>
70 <th>
71 <i class="icon-question-sign get-help" title="The date and time the build finished"></i>
72 Build completed on
73 </th>
74 </thead>
75 <tbody>
76 {% for match in matching_tasks %}
77 <tr>
78 <td>
79 <a href="{%url "task" match.build.pk match.pk%}">{{match.recipe.name}}</a>
80 </td>
81 <td>
82 <a href="{%url "task" match.build.pk match.pk%}">{{match.task_name}}</a>
83 </td>
84 <td>
85 <a href="{%url "task" match.build.pk match.pk%}">{{match.get_executed_display}}</a>
86 </td>
87 <td>
88 <a href="{%url "task" match.build.pk match.pk%}">{{match.get_outcome_display}}</a><i class="icon-question-sign get-help hover-help" title="" style="visibility: hidden;" data-original-title="{{match.outcome_help}}"></i>
89 </td>
90 <td>
91 <a href="{%url "task" match.build.pk match.pk%}">{{match.build.completed_on|date:"d/m/y H:i"}}</a>
92 </td>
93 </tr>
94 {% endfor %}
95 </tbody>
96 </table>
97 {% else %}
98 <p class="alert">
99 We have found no tasks matching this prebuilt task.<br/>
100 The task you are looking for could belong to a build for which Toaster has not data.
101 </p>
102 {% endif %}
103 {% elif task.outcome == task.OUTCOME_COVERED %}
104 <dl class="dl-horizontal">
105 <dt>
106 <i class="icon-question-sign get-help" title="" data-toggle="tooltip" data-original-title="The task providing the outcome of this task"></i>Task covered by
107 </dt>
108 <dd>
109 <ul>
110 <li><p class="alert-info">TODO:Covering tasks will be displayed here</p></li>
111 </ul>
112 </dd>
113 </dl>
114 {%elif task.outcome == task.OUTCOME_CACHED%}
115 <dl class="dl-horizontal">
116 <dt>
117 <i class="icon-question-sign get-help" title="" data-original-title="The location in disk of the task log file"></i> Log file
118 </dt>
119 <dd>
120 <code>{% for t in task.get_related_setscene %} {{t.logfile}}<br/>{% endfor %}
121 </code>
122 </dd>
123 </dl>
124 {% endif %}
125{% endif %}
126
127{# Execution section #}
128<h2 {{task|task_color}}>
129 {% if task.task_executed %}
130 Executed
131 <i class="icon-question-sign get-help heading-help" title="" data-original-title="Executed tasks are those that need to run in order to generate the task output"></i>
132 {% else %}
133 Not Executed
134 <i class="icon-question-sign get-help heading-help" title="" data-original-title="Not executed tasks don't need to run because their outcome is provided by another task"></i>
135 {% endif %}
136</h2>
137<dl class="dl-horizontal">
138 <dt>
139 <i class="icon-question-sign get-help" title="To make builds more efficient, the build system detects changes in the 'inputs' to a given task by creating a 'task signature'. If the signature changes, the build system assumes the inputs have changed and the task needs to be rerun"></i>
140 Task inputs signature
141 </dt>
142 <dd>
143 {{task.sstate_checksum}}
144 </dd>
145</dl>
146 {% if task.sstate_result != task.SSTATE_NA %}
147 <div class="alert alert-info">Attempting to restore output from sstate cache
148 <i class="icon-question-sign get-help get-help-blue" title="The build system is searching for the task output in your <code>sstate-cache</code> directory and mirrors. If it finds it, it will use it instead of building it from scratch by running the real task. This makes the build faster"></i>
149 </div>
150 <dl class="dl-horizontal">
151 <dt>
152 <i class="icon-question-sign get-help" title="The name of the file searched for in your <code>sstate-cache</code> directory and mirrors"></i>
153 File searched for
154 </dt>
155 <dd><code>{{task.path_to_sstate_obj}}</code></dd>
156 <dt>
157 <i class="icon-question-sign get-help" title="The locations where the above file was searched: your <code>sstate-cache</code> directory and the mirrors you have set up (if any)"></i>
158 URI(s) searched
159 </dt>
160 <dd><code>{{task.work_directory}}</code></dd>
161 </dl>
162 {% endif %}
163 {% if task.sstate_result == task.SSTATE_MISS %}
164 <div class="alert alert-info">
165 <strong>File not in sstate cache.</strong> Running the real task instead.
166 </div>
167 {% elif task.sstate_result == task.SSTATE_FAILED%}
168 <div class="alert">
169 <strong>Failed</strong> to restore output from sstate cache. The file was found but could not be unpacked.
170 </div>
171 <dl class="dl-horizontal">
172 <dt>
173 <i class="icon-question-sign get-help" title="The location in disk of the cache attempt log file"></i>
174 Log file
175 </dt>
176 <dd><code>{{task.logfile}}</code></dd>
177 <dt>
178 <i class="icon-question-sign get-help" title="How long it took the cache attempt to finish, expressed in seconds"></i>
179 Time (secs)
180 </dt>
181 <dd>{{task.elapsed_time|format_none_and_zero}}</dd>
182 </dl>
183 <div class="alert alert-info">
184 Running the real task instead.
185 </div>
186 {% elif task.sstate_result == task.SSTATE_RESTORED %}
187 <div class="alert alert-info">
188 Output successfully restored from sstate cache.
189 </div>
190 {% endif %}
191 <dl class="dl-horizontal">
192 <dt>
193 <i class="icon-question-sign get-help" title="The running sequence of each task in the build"></i>
194 Task order
195 </dt>
196 <dd><a href="{%url "tasks" build.pk %}#{{task.order}}">{{task.order}}</a></dd>
197 {% if task.task_executed %}
198 <dt>
199 <i class="icon-question-sign get-help" title="If this task executes a Python or Shell function(s)"></i>
200 Task script type
201 </dt>
202 <dd>{{task.get_script_type_display}}</dd>
203 {% endif %}
204<!--
205 <dt>
206 <i class="icon-question-sign get-help" title="The code executed by the task"></i>
207 Task executable output
208 </dt>
209 <dd><code>{{task.source_url}}</code></dd>
210-->
211 <dt>
212 <i class="icon-question-sign get-help" title="Task dependency chain (other tasks)"></i>
213 Task depends on
214 </dt>
215 <dd>
216 <ul>
217 {% for dep in deps %}
218 <li><a href="{%url 'task' dep.build.pk dep.pk%}" class="task-info" title="{{dep.get_executed_display}} | {{dep.get_outcome_display}}">{{dep.recipe.name}}_{{dep.recipe.version}} <span class="task-name">{{dep.task_name}}</span></a></li>
219 {% empty %}
220 <li><p class="alert-info">This task has no dependencies</p></li>
221 {% endfor %}
222 </ul>
223 </dd>
224 <dt>
225 <i class="icon-question-sign get-help" title="Which other tasks depend on this task"></i>
226 Task reverse dependencies
227 </dt>
228 <dd>
229 <ul>
230 {% for dep in rdeps %}
231 <li><a href="{%url 'task' dep.build.pk dep.pk%}" class="task-info" title="{{dep.get_executed_display}} | {{dep.get_outcome_display}}">{{dep.recipe.name}}_{{dep.recipe.version}} <span class="task-name">{{dep.task_name}}</span></a></li>
232 {% empty %}
233 <li><p class="alert-info">This task has no reverse dependencies</p></li>
234 {% endfor %}
235 </ul>
236</dl>
237
238{# Performance section - shown only for executed tasks #}
239{%if task.task_executed %}
240 <h2 class="details">Performance</h2>
241 <dl class="dl-horizontal">
242 <dt>
243 <i class="icon-question-sign get-help" title="How long it took the task to finish, expressed in seconds"></i>
244 Time (secs)
245 </dt>
246 <dd>{{task.elapsed_time|format_none_and_zero}}</dd>
247 <dt>
248 <i class="icon-question-sign get-help" title="Task CPU utilisation, expressed as a percentage"></i>
249 CPU usage
250 </dt>
251 <dd>{{task.cpu_usage|format_none_and_zero}}</dd>
252 <dt>
253 <i class="icon-question-sign get-help" title="Number of miliseconds the task spent doing disk input and output"></i>
254 Disk I/O (ms)
255 </dt>
256 <dd>{{task.disk_io|format_none_and_zero}}</dd>
257 </dl>
258{%endif%}
259
260
261</div>
262{% endblock %}
263
diff --git a/bitbake/lib/toaster/toastergui/templates/tasks.html b/bitbake/lib/toaster/toastergui/templates/tasks.html
index 7dc2c38b18..ce75b75c94 100644
--- a/bitbake/lib/toaster/toastergui/templates/tasks.html
+++ b/bitbake/lib/toaster/toastergui/templates/tasks.html
@@ -20,9 +20,9 @@
20{% include "basetable_top.html" %} 20{% include "basetable_top.html" %}
21 21
22 {% for task in objects %} 22 {% for task in objects %}
23 <tr {{ task|task_color }} > 23 <tr {{ task|task_color }} class="flash" id="{{task.order}}" name="{{task.order}}">
24 <td class="order"> 24 <td class="order">
25 <a href="{%url "task" build.pk task.pk%} ">{{task.order}}</a> 25 <a href="{%url "task" build.pk task.pk%}">{{task.order}}</a>
26 </td> 26 </td>
27 <td class="recipe_name" > 27 <td class="recipe_name" >
28 <a href="{% url "recipe" build.pk task.recipe.pk %}">{{task.recipe.name}}</a> 28 <a href="{% url "recipe" build.pk task.recipe.pk %}">{{task.recipe.name}}</a>
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index 7e2c8e98fa..b1e573b16d 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -70,13 +70,17 @@ def sortcols(tablecols):
70 return sorted(tablecols, key = lambda t: t['name']) 70 return sorted(tablecols, key = lambda t: t['name'])
71 71
72@register.filter 72@register.filter
73def task_color(task_object): 73def task_color(task_object, show_green=False):
74 """ Return css class depending on Task execution status and execution outcome 74 """ Return css class depending on Task execution status and execution outcome.
75 By default, green is not returned for executed and successful tasks;
76 show_green argument should be True to get green color.
75 """ 77 """
76 if not task_object.task_executed: 78 if not task_object.task_executed:
77 return 'class=muted' 79 return 'class=muted'
78 elif task_object.outcome == task_object.OUTCOME_FAILED: 80 elif task_object.outcome == task_object.OUTCOME_FAILED:
79 return 'class=error' 81 return 'class=error'
82 elif task_object.outcome == task_object.OUTCOME_SUCCESS and show_green:
83 return 'class=green'
80 else: 84 else:
81 return '' 85 return ''
82 86
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 11c8fd806e..b77be1a6e7 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -349,12 +349,36 @@ def builddashboard(request, build_id):
349 return render(request, template, context) 349 return render(request, template, context)
350 350
351def task(request, build_id, task_id): 351def task(request, build_id, task_id):
352 template = "singletask.html" 352 template = "task.html"
353 if Build.objects.filter(pk=build_id).count() == 0 : 353 if Task.objects.filter(pk=task_id).count() == 0 :
354 return redirect(builds) 354 return redirect(builds)
355 task = Task.objects.filter(pk=task_id)[0]
356
357 dependencies = sorted(_find_task_dep(task), key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name))
358 reverse_dependencies = sorted(_find_task_revdep(task), key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name))
359
360 log_head = ''
361 log_body = ''
362 if task.outcome == task.OUTCOME_FAILED:
363 pass
364# FIXME: the log should be read from the orm_logmessage table.
365# This will be fixed when the backend is done.
366
355 context = { 367 context = {
356 'build' : Build.objects.filter(pk=build_id)[0], 368 'build' : Build.objects.filter(pk=build_id)[0],
369 'object': task,
370 'task':task,
371 'deps': dependencies,
372 'rdeps': reverse_dependencies,
373 'log_head':log_head,
374 'log_body':log_body,
375 'showing_matches':False,
357 } 376 }
377
378 if request.GET.get('show_matches', ""):
379 context['showing_matches'] = True
380 context['matching_tasks'] = Task.objects.filter(sstate_checksum=task.sstate_checksum).filter(build__completed_on__lt=task.build.completed_on).order_by('-build__completed_on')
381
358 return render(request, template, context) 382 return render(request, template, context)
359 383
360def recipe(request, build_id, recipe_id): 384def recipe(request, build_id, recipe_id):
@@ -388,6 +412,12 @@ def target(request, build_id, target_id):
388 return render(request, template, context) 412 return render(request, template, context)
389 413
390 414
415def _find_task_dep(task):
416 tp = []
417 for p in Task_Dependency.objects.filter(task=task):
418 tp.append(p.depends_on);
419 return tp
420
391 421
392def _find_task_revdep(task): 422def _find_task_revdep(task):
393 tp = [] 423 tp = []