aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-05-26 16:12:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-15 08:35:04 +0100
commitb2a68f55110b39aaf0b0d47bf533251a59a40a41 (patch)
tree7791ed85141e07f01c228619047740b235ee02dc /bitbake
parent32d1e2dd25f288790450db48766cf115854712ba (diff)
downloadopenembedded-core-contrib-b2a68f55110b39aaf0b0d47bf533251a59a40a41.tar.gz
bitbake: toaster: port Task tables to ToasterTables widget
Port the Task based tables to ToasterTable. This is the Task, Time, CPU usage and Disk I/O tables. (Bitbake rev: bebcef7a4bf08b10e472475435ddc7a524364adb) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/buildtables.py227
-rw-r--r--bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/buildtime.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/task.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/tasks.html141
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py23
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py280
7 files changed, 248 insertions, 433 deletions
diff --git a/bitbake/lib/toaster/toastergui/buildtables.py b/bitbake/lib/toaster/toastergui/buildtables.py
index dc742b9fe5..51c136f988 100644
--- a/bitbake/lib/toaster/toastergui/buildtables.py
+++ b/bitbake/lib/toaster/toastergui/buildtables.py
@@ -19,10 +19,13 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from orm.models import Build
-import toastergui.tables as tables
+from orm.models import Build, Task
+from django.db.models import Q
+import toastergui.tables as tables
from toastergui.widgets import ToasterTable
+from toastergui.tablefilter import TableFilter
+from toastergui.tablefilter import TableFilterActionToggle
class BuildTablesMixin(ToasterTable):
@@ -279,3 +282,223 @@ class BuiltRecipesTable(BuildTablesMixin):
self.add_column(title="Layer commit",
static_data_name="commit",
static_data_template=git_rev_template)
+
+
+class BuildTasksTable(BuildTablesMixin):
+ """ Table to show the tasks that run in this build """
+
+ def __init__(self, *args, **kwargs):
+ super(BuildTasksTable, self).__init__(*args, **kwargs)
+ self.title = "Tasks"
+ self.default_orderby = "order"
+
+ # Toggle these columns on off for Time/CPU usage/Disk I/O tables
+ self.toggle_columns = {}
+
+ def setup_queryset(self, *args, **kwargs):
+ build = Build.objects.get(pk=kwargs['build_id'])
+ self.static_context_extra['build'] = build
+ self.queryset = build.task_build.filter(~Q(order=None))
+ self.queryset = self.queryset.order_by(self.default_orderby)
+
+ def setup_filters(self, *args, **kwargs):
+ # Execution outcome types filter
+ executed_outcome = TableFilter(name="execution_outcome",
+ title="Filter Tasks by 'Executed")
+
+ exec_outcome_action_exec = TableFilterActionToggle(
+ "executed",
+ "Executed Tasks",
+ Q(task_executed=True))
+
+ exec_outcome_action_not_exec = TableFilterActionToggle(
+ "not_executed",
+ "Not Executed Tasks",
+ Q(task_executed=False))
+
+ executed_outcome.add_action(exec_outcome_action_exec)
+ executed_outcome.add_action(exec_outcome_action_not_exec)
+
+ # Task outcome types filter
+ task_outcome = TableFilter(name="task_outcome",
+ title="Filter Task by 'Outcome'")
+
+ for outcome_enum, title in Task.TASK_OUTCOME:
+ action = TableFilterActionToggle(
+ title.replace(" ", "_").lower(),
+ "%s Tasks" % title,
+ Q(outcome=outcome_enum))
+
+ task_outcome.add_action(action)
+
+ # SSTATE outcome types filter
+ sstate_outcome = TableFilter(name="sstate_outcome",
+ title="Filter Task by 'Cache attempt'")
+
+ for sstate_result_enum, title in Task.SSTATE_RESULT:
+ action = TableFilterActionToggle(
+ title.replace(" ", "_").lower(),
+ "Tasks with '%s' attempts" % title,
+ Q(sstate_result=sstate_result_enum))
+
+ sstate_outcome.add_action(action)
+
+ self.add_filter(sstate_outcome)
+ self.add_filter(executed_outcome)
+ self.add_filter(task_outcome)
+
+ def setup_columns(self, *args, **kwargs):
+ self.toggle_columns['order'] = len(self.columns)
+
+ recipe_name_tmpl =\
+ '<a href="{% url "recipe" extra.build.pk data.recipe.pk %}">'\
+ '{{data.recipe.name}}'\
+ '</a>'
+
+ recipe_version_tmpl =\
+ '<a href="{% url "recipe" extra.build.pk data.recipe.pk %}">'\
+ '{{data.recipe.version}}'\
+ '</a>'
+
+ def task_link_tmpl(val):
+ return ('<a name="task-{{data.order}}"'
+ 'href="{%% url "task" extra.build.pk data.pk %%}">'
+ '%s'
+ '</a>') % str(val)
+
+ self.add_column(title="Order",
+ static_data_name="order",
+ static_data_template=task_link_tmpl('{{data.order}}'),
+ orderable=True)
+
+ self.add_column(title="Recipe",
+ static_data_name='recipe__name',
+ static_data_template=recipe_name_tmpl,
+ orderable=True)
+
+ self.add_column(title="Recipe version",
+ static_data_name='recipe__version',
+ static_data_template=recipe_version_tmpl)
+
+ self.add_column(title="Task",
+ static_data_name="task_name",
+ static_data_template=task_link_tmpl(
+ "{{data.task_name}}"),
+ orderable=True)
+
+ self.add_column(title="Executed",
+ static_data_name="task_executed",
+ static_data_template=task_link_tmpl(
+ "{{data.get_executed_display}}"),
+ filter_name='execution_outcome',
+ orderable=True)
+
+ self.static_context_extra['OUTCOME_FAILED'] = Task.OUTCOME_FAILED
+ outcome_tmpl = task_link_tmpl("{{data.outcome_text}}")
+ outcome_tmpl = ('%s '
+ '{%% if data.outcome = extra.OUTCOME_FAILED %%}'
+ '<a href="{%% url "build_artifact" extra.build.pk '
+ ' "tasklogfile" data.pk %%}">'
+ ' <i class="icon-download-alt" '
+ ' title="Download task log file"></i>'
+ '</a> {%% endif %%}'
+ '<i class="icon-question-sign get-help '
+ 'hover-help" style="visibility: hidden;" '
+ 'title="{{data.get_outcome_help}}"></i>'
+ ) % outcome_tmpl
+
+ self.add_column(title="Outcome",
+ static_data_name="outcome",
+ static_data_template=outcome_tmpl,
+ filter_name="task_outcome",
+ orderable=True)
+
+ self.add_column(title="Cache attempt",
+ static_data_name="sstate_result",
+ static_data_template=task_link_tmpl(
+ "{{data.sstate_text}}"),
+ filter_name="sstate_outcome",
+ orderable=True)
+
+ self.toggle_columns['elapsed_time'] = len(self.columns)
+
+ self.add_column(
+ title="Time (secs)",
+ static_data_name="elapsed_time",
+ static_data_template='{% load projecttags %}{% load humanize %}'
+ '{{data.elapsed_time|format_none_and_zero|floatformat:2}}',
+ orderable=True,
+ hidden=True)
+
+ self.toggle_columns['cpu_time_sys'] = len(self.columns)
+
+ self.add_column(
+ title="System CPU time (secs)",
+ static_data_name="cpu_time_system",
+ static_data_template='{% load projecttags %}{% load humanize %}'
+ '{{data.cpu_time_system|format_none_and_zero|floatformat:2}}',
+ hidden=True,
+ orderable=True)
+
+ self.toggle_columns['cpu_time_user'] = len(self.columns)
+
+ self.add_column(
+ title="User CPU time (secs)",
+ static_data_name="cpu_time_user",
+ static_data_template='{% load projecttags %}{% load humanize %}'
+ '{{data.cpu_time_user|format_none_and_zero|floatformat:2}}',
+ hidden=True,
+ orderable=True)
+
+ self.toggle_columns['disk_io'] = len(self.columns)
+
+ self.add_column(
+ title="Disk I/O (ms)",
+ static_data_name="disk_io",
+ static_data_template='{% load projecttags %}{% load humanize %}'
+ '{{data.disk_io|format_none_and_zero|filtered_filesizeformat}}',
+ hidden=True,
+ orderable=True)
+
+
+class BuildTimeTable(BuildTasksTable):
+ """ Same as tasks table but the Time column is default displayed"""
+
+ def __init__(self, *args, **kwargs):
+ super(BuildTimeTable, self).__init__(*args, **kwargs)
+ self.default_orderby = "-elapsed_time"
+
+ def setup_columns(self, *args, **kwargs):
+ super(BuildTimeTable, self).setup_columns(**kwargs)
+
+ self.columns[self.toggle_columns['order']]['hidden'] = True
+ self.columns[self.toggle_columns['elapsed_time']]['hidden'] = False
+
+
+class BuildCPUTimeTable(BuildTasksTable):
+ """ Same as tasks table but the CPU usage columns are default displayed"""
+
+ def __init__(self, *args, **kwargs):
+ super(BuildCPUTimeTable, self).__init__(*args, **kwargs)
+ self.default_orderby = "-cpu_time_system"
+
+ def setup_columns(self, *args, **kwargs):
+ super(BuildCPUTimeTable, self).setup_columns(**kwargs)
+
+ self.columns[self.toggle_columns['order']]['hidden'] = True
+ self.columns[self.toggle_columns['cpu_time_sys']]['hidden'] = False
+ self.columns[self.toggle_columns['cpu_time_user']]['hidden'] = False
+
+
+class BuildIOTable(BuildTasksTable):
+ """ Same as tasks table but the Disk IO column is default displayed"""
+
+ def __init__(self, *args, **kwargs):
+ super(BuildIOTable, self).__init__(*args, **kwargs)
+ self.default_orderby = "-disk_io"
+
+ def setup_columns(self, *args, **kwargs):
+ super(BuildIOTable, self).setup_columns(**kwargs)
+
+ self.columns[self.toggle_columns['order']]['hidden'] = True
+ self.columns[self.toggle_columns['disk_io']]['hidden'] = False
diff --git a/bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html b/bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html
index 4ce5c4a8a5..52cc0569f7 100644
--- a/bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html
+++ b/bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html
@@ -12,12 +12,14 @@
{% block buildinfomain %}
<div class="span10">
-{% url 'builtpackagestable' build.id as xhr_table_url %}
+{# xhr_table_url is just the current url so leave it blank #}
+{% with xhr_table_url='' %}
<div class="page-header">
<h1>
{{title}} (<span class="table-count-{{table_name}}">0</span>) </h2>
</h1>
</div>
{% include "toastertable.html" %}
+{% endwith %}
</div>
{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/buildtime.html b/bitbake/lib/toaster/toastergui/templates/buildtime.html
deleted file mode 100644
index ea84ae797c..0000000000
--- a/bitbake/lib/toaster/toastergui/templates/buildtime.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{% extends "basebuildpage.html" %}
-{% block localbreadcrumb %}
-<li>Build Time</li>
-{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/task.html b/bitbake/lib/toaster/toastergui/templates/task.html
index 8773351fab..77391b4e35 100644
--- a/bitbake/lib/toaster/toastergui/templates/task.html
+++ b/bitbake/lib/toaster/toastergui/templates/task.html
@@ -196,7 +196,7 @@
<i class="icon-question-sign get-help" title="The running sequence of each task in the build"></i>
Task order
</dt>
- <dd><a href="{%url "tasks_task" build.pk task.order %}#{{task.order}}">{{task.order}}</a></dd>
+ <dd><a href="{%url "tasks" build.pk %}?page={{task_in_tasks_table_pg}}&limit=25#task-{{task.order}}">{{task.order}}</a></dd>
{% if task.task_executed %}
<dt>
<i class="icon-question-sign get-help" title="Indicates if this task executes a Python or Shell function(s)"></i>
diff --git a/bitbake/lib/toaster/toastergui/templates/tasks.html b/bitbake/lib/toaster/toastergui/templates/tasks.html
deleted file mode 100644
index b3b7621e60..0000000000
--- a/bitbake/lib/toaster/toastergui/templates/tasks.html
+++ /dev/null
@@ -1,141 +0,0 @@
-{% extends "basebuildpage.html" %}
-{% load humanize %}
-{% load projecttags %}
-
-{% block title %} {{mainheading}} - {{build.target_set.all|dictsort:"target"|join:", "}} {{build.machine}} - {{build.project.name}} - Toaster{% endblock %}
-{% block localbreadcrumb %}
-<li>{{mainheading}}</li>
-{% endblock %}
-
-{% block nav-tasks %}
- {% if 'Tasks' == mainheading %}
- <li class="active"><a href="{% url 'tasks' build.pk %}">Tasks</a></li>
- {% else %}
- <li><a href="{% url 'tasks' build.pk %}">Tasks</a></li>
- {% endif %}
-{% endblock %}
-{% block nav-buildtime %}
- {% if 'Time' == mainheading %}
- <li class="active"><a href="{% url 'buildtime' build.pk %}">Time</a></li>
- {% else %}
- <li><a href="{% url 'buildtime' build.pk %}">Time</a></li>
- {% endif %}
-{% endblock %}
-
-{% block nav-cputime %}
- {% if 'CPU time' == mainheading %}
- <li class="active"><a href="{% url 'cputime' build.pk %}">CPU time</a></li>
- {% else %}
- <li><a href="{% url 'cputime' build.pk %}">CPU time</a></li>
- {% endif %}
-{% endblock %}
-
-{% block nav-diskio %}
- {% if 'Disk I/O' == mainheading %}
- <li class="active"><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li>
- {% else %}
- <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li>
- {% endif %}
-{% endblock %}
-
-{% block buildinfomain %}
-<div class="col-md-10">
-{% if not request.GET.filter and not request.GET.search and not objects.paginator.count %}
- <!-- Empty - no data in database -->
- <div class="page-header">
- <h1>{{mainheading}}</h1>
- </div>
- <div class="alert alert-info lead">
- No data was recorded for this build.
- </div>
-
-{% else %}
-
- <div class="page-header">
- <h1>
- {% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
- {{objects.paginator.count}} task{{objects.paginator.count|pluralize}} found
- {%elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %}
- No tasks found
- {%else%}
- {{mainheading}}
- {%endif%}
- </h1>
- </div>
-
- {% if objects.paginator.count == 0 %}
- <div class="alert">
- <form class="no-results input-append" id="searchform">
- <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="input-append-addon btn" tabindex="-1"><i class="glyphicon glyphicon-remove"></i></a>{% endif %}
- <button class="btn" type="submit" value="Search">Search</button>
- <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all tasks</button>
- </form>
- </div>
-
-
- {% else %}
- {% include "basetable_top.html" %}
-
- {% for task in objects %}
- <tr {{ task|task_color }} id="{{task.order}}">
- <td class="order">
- <a href="{%url "task" build.pk task.pk%}">{{task.order}}</a>
- </td>
- <td class="recipe_name" >
- <a href="{% url "recipe" build.pk task.recipe.pk %}">{{task.recipe.name}}</a>
- </td>
- <td class="recipe_version">
- <a href="{% url "recipe" build.pk task.recipe.pk %}">{{task.recipe.version}}</a>
- </td>
- <td class="task_name">
- <a href="{%url "task" build.pk task.pk%}">{{task.task_name}}</a> {% if task.get_description %}<i class="icon-question-sign get-help hover-help" title="{{task.get_description}}"></i> {% endif %}
- </td>
- <td class="executed">
- <a href="{%url "task" build.pk task.pk%}">{{task.get_executed_display}}</a>
- </td>
- <td class="outcome">
- <a href="{%url "task" build.pk task.pk%}">{{task.get_outcome_display}} </a>
- {% if task.outcome = task.OUTCOME_FAILED %}
- <a href="{% url 'build_artifact' build.pk "tasklogfile" task.pk %}">
- <i class="icon-download-alt" title="Download task log file"></i>
- </a>
- {% endif %}
- <i class="icon-question-sign get-help hover-help" title="{{task.get_outcome_help}}"></i>
- </td>
- <td class="cache_attempt">
- <a href="{%url "task" build.pk task.pk%}">{{task.get_sstate_result_display|format_none_and_zero}}</a>
- </td>
- <td class="time_taken">
- {{task.elapsed_time|format_none_and_zero|floatformat:2}}
- </td>
- <td class="cpu_time_system">
- {{task.cpu_time_system|format_none_and_zero|floatformat:2}}
- </td>
- <td class="cpu_time_user">
- {{task.cpu_time_user|format_none_and_zero|floatformat:2}}
- </td>
- <td class="disk_io">
- {{task.disk_io|format_none_and_zero|intcomma}}
- </td>
-
- </tr>
- {% endfor %}
-
- {% include "basetable_bottom.html" %}
- {% endif %} {# objects.paginator.count #}
-{% endif %} {# empty #}
-</div>
-
-<script type="text/javascript">
-
- $(document).ready(function() {
- // highlight heading on the column for the field used for ordering
- if (location.href.search('#') > -1) {
- var task_order = location.href.split('#')[1];
- $("#" + task_order).addClass("highlight");
- }
- });
-
-</script>
-
-{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index 0636c956b2..c4913f124a 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -35,9 +35,11 @@ urlpatterns = patterns('toastergui.views',
# build info navigation
url(r'^build/(?P<build_id>\d+)$', 'builddashboard', name="builddashboard"),
+ url(r'^build/(?P<build_id>\d+)/tasks/$',
+ buildtables.BuildTasksTable.as_view(
+ template_name="buildinfo-toastertable.html"),
+ name='tasks'),
- url(r'^build/(?P<build_id>\d+)/tasks/$', 'tasks', name='tasks'),
- url(r'^build/(?P<build_id>\d+)/tasks/(?P<task_id>\d+)/$', 'tasks_task', name='tasks_task'),
url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'),
url(r'^build/(?P<build_id>\d+)/recipes/$',
@@ -74,9 +76,20 @@ urlpatterns = patterns('toastergui.views',
url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo_filepath/_(?P<file_path>(?:/[^/\n]+)*)$', 'dirinfo', name='dirinfo_filepath'),
url(r'^build/(?P<build_id>\d+)/configuration$', 'configuration', name='configuration'),
url(r'^build/(?P<build_id>\d+)/configvars$', 'configvars', name='configvars'),
- url(r'^build/(?P<build_id>\d+)/buildtime$', 'buildtime', name='buildtime'),
- url(r'^build/(?P<build_id>\d+)/cputime$', 'cputime', name='cputime'),
- url(r'^build/(?P<build_id>\d+)/diskio$', 'diskio', name='diskio'),
+ url(r'^build/(?P<build_id>\d+)/buildtime$',
+ buildtables.BuildTimeTable.as_view(
+ template_name="buildinfo-toastertable.html"),
+ name='buildtime'),
+
+ url(r'^build/(?P<build_id>\d+)/cputime$',
+ buildtables.BuildCPUTimeTable.as_view(
+ template_name="buildinfo-toastertable.html"),
+ name='cputime'),
+
+ url(r'^build/(?P<build_id>\d+)/diskio$',
+ buildtables.BuildIOTable.as_view(
+ template_name="buildinfo-toastertable.html"),
+ name='diskio'),
# image information dir
url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/packagefile/(?P<packagefile_id>\d+)$',
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 3a25d5ea1e..35ab63a22e 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -596,6 +596,7 @@ def task( request, build_id, task_id ):
'log_body' : log_body,
'showing_matches' : False,
'uri_list' : uri_list,
+ 'task_in_tasks_table_pg': int(task_object.order / 25) + 1
}
if request.GET.get( 'show_matches', "" ):
context[ 'showing_matches' ] = True
@@ -995,285 +996,6 @@ def _find_task_provider(task_object):
return trc
return None
-def tasks_common(request, build_id, variant, task_anchor):
-# This class is shared between these pages
-#
-# Column tasks buildtime diskio cpuusage
-# --------- ------ ---------- ------- ---------
-# Cache def
-# CPU min -
-# Disk min -
-# Executed def def def def
-# Log
-# Order def +
-# Outcome def def def def
-# Recipe min min min min
-# Version
-# Task min min min min
-# Time min -
-#
-# 'min':on always, 'def':on by default, else hidden
-# '+' default column sort up, '-' default column sort down
-
- anchor = request.GET.get('anchor', '')
- if not anchor:
- anchor=task_anchor
-
- # default ordering depends on variant
- default_orderby = None
- filter_search_display = 'tasks'
-
- if 'buildtime' == variant:
- default_orderby = 'elapsed_time:-'
- title_variant = 'Time'
- object_search_display = 'time data'
- elif 'diskio' == variant:
- default_orderby = 'disk_io:-'
- title_variant = 'Disk I/O'
- object_search_display = 'disk I/O data'
- elif 'cputime' == variant:
- default_orderby = 'cpu_time_system:-'
- title_variant='CPU time'
- object_search_display = 'CPU time data'
- else:
- default_orderby = 'order:+'
- title_variant = 'Tasks'
- object_search_display = 'tasks'
-
- (pagesize, orderby) = _get_parameters_values(request, 25, default_orderby)
-
- mandatory_parameters = {'count': pagesize, 'page' : 1, 'orderby': orderby}
-
- template = 'tasks.html'
- retval = _verify_parameters( request.GET, mandatory_parameters )
- if retval:
- if task_anchor:
- mandatory_parameters['anchor']=task_anchor
- return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
- (filter_string, search_term, ordering_string) = _search_tuple(request, Task)
- queryset_all = Task.objects.filter(build=build_id).exclude(order__isnull=True).exclude(outcome=Task.OUTCOME_NA)
- queryset_all = queryset_all.select_related("recipe", "build")
-
- queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string, 'order')
-
- if ordering_string.startswith('outcome'):
- queryset = _get_queryset(Task, queryset_all, filter_string, search_term, 'order:+', 'order')
- queryset = sorted(queryset, key=lambda ur: (ur.outcome_text), reverse=ordering_string.endswith('-'))
- elif ordering_string.startswith('sstate_result'):
- queryset = _get_queryset(Task, queryset_all, filter_string, search_term, 'order:+', 'order')
- queryset = sorted(queryset, key=lambda ur: (ur.sstate_text), reverse=ordering_string.endswith('-'))
- else:
- queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order')
-
-
- # compute the anchor's page
- if anchor:
- request.GET = request.GET.copy()
- del request.GET['anchor']
- i=0
- a=int(anchor)
- count_per_page=int(pagesize)
- for task_object in queryset.iterator():
- if a == task_object.order:
- new_page= (i / count_per_page ) + 1
- request.GET.__setitem__('page', new_page)
- mandatory_parameters['page']=new_page
- return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
- i += 1
-
- task_objects = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1))
-
- # define (and modify by variants) the 'tablecols' members
- tc_order={
- 'name':'Order',
- 'qhelp':'The running sequence of each task in the build',
- 'clclass': 'order', 'hidden' : 1,
- 'orderkey' : 'order',
- 'orderfield':_get_toggle_order(request, "order"),
- 'ordericon':_get_toggle_order_icon(request, "order")}
- if 'tasks' == variant:
- tc_order['hidden']='0'
- del tc_order['clclass']
-
- tc_recipe={
- 'name':'Recipe',
- 'qhelp':'The name of the recipe to which each task applies',
- 'orderkey' : 'recipe__name',
- 'orderfield': _get_toggle_order(request, "recipe__name"),
- 'ordericon':_get_toggle_order_icon(request, "recipe__name"),
- }
- tc_recipe_version={
- 'name':'Recipe version',
- 'qhelp':'The version of the recipe to which each task applies',
- 'clclass': 'recipe_version', 'hidden' : 1,
- }
- tc_task={
- 'name':'Task',
- 'qhelp':'The name of the task',
- 'orderfield': _get_toggle_order(request, "task_name"),
- 'ordericon':_get_toggle_order_icon(request, "task_name"),
- 'orderkey' : 'task_name',
- }
- tc_executed={
- 'name':'Executed',
- 'qhelp':"This value tells you if a task had to run (executed) in order to generate the task output, or if the output was provided by another task and therefore the task didn't need to run (not executed)",
- 'clclass': 'executed', 'hidden' : 0,
- 'orderfield': _get_toggle_order(request, "task_executed"),
- 'ordericon':_get_toggle_order_icon(request, "task_executed"),
- 'orderkey' : 'task_executed',
- 'filter' : {
- 'class' : 'executed',
- 'label': 'Show:',
- 'options' : [
- ('Executed Tasks', 'task_executed:1', queryset_with_search.filter(task_executed=1).count()),
- ('Not Executed Tasks', 'task_executed:0', queryset_with_search.filter(task_executed=0).count()),
- ]
- }
-
- }
- tc_outcome={
- 'name':'Outcome',
- 'qhelp':"This column tells you if 'executed' tasks succeeded or failed. The column also tells you why 'not executed' tasks did not need to run",
- 'clclass': 'outcome', 'hidden' : 0,
- 'orderfield': _get_toggle_order(request, "outcome"),
- 'ordericon':_get_toggle_order_icon(request, "outcome"),
- 'orderkey' : 'outcome',
- 'filter' : {
- 'class' : 'outcome',
- 'label': 'Show:',
- 'options' : [
- ('Succeeded Tasks', 'outcome:%d'%Task.OUTCOME_SUCCESS, queryset_with_search.filter(outcome=Task.OUTCOME_SUCCESS).count(), "'Succeeded' tasks are those that ran and completed during the build" ),
- ('Failed Tasks', 'outcome:%d'%Task.OUTCOME_FAILED, queryset_with_search.filter(outcome=Task.OUTCOME_FAILED).count(), "'Failed' tasks are those that ran but did not complete during the build"),
- ('Cached Tasks', 'outcome:%d'%Task.OUTCOME_CACHED, queryset_with_search.filter(outcome=Task.OUTCOME_CACHED).count(), 'Cached tasks restore output from the <code>sstate-cache</code> directory or mirrors'),
- ('Prebuilt Tasks', 'outcome:%d'%Task.OUTCOME_PREBUILT, queryset_with_search.filter(outcome=Task.OUTCOME_PREBUILT).count(),'Prebuilt tasks didn\'t need to run because their output was reused from a previous build'),
- ('Covered Tasks', 'outcome:%d'%Task.OUTCOME_COVERED, queryset_with_search.filter(outcome=Task.OUTCOME_COVERED).count(), 'Covered tasks didn\'t need to run because their output is provided by another task in this build'),
- ('Empty Tasks', 'outcome:%d'%Task.OUTCOME_EMPTY, queryset_with_search.filter(outcome=Task.OUTCOME_EMPTY).count(), 'Empty tasks have no executable content'),
- ]
- }
-
- }
-
- tc_cache={
- 'name':'Cache attempt',
- 'qhelp':'This column tells you if a task tried to restore output from the <code>sstate-cache</code> directory or mirrors, and reports the result: Succeeded, Failed or File not in cache',
- 'clclass': 'cache_attempt', 'hidden' : 0,
- 'orderfield': _get_toggle_order(request, "sstate_result"),
- 'ordericon':_get_toggle_order_icon(request, "sstate_result"),
- 'orderkey' : 'sstate_result',
- 'filter' : {
- 'class' : 'cache_attempt',
- 'label': 'Show:',
- 'options' : [
- ('Tasks with cache attempts', 'sstate_result__gt:%d'%Task.SSTATE_NA, queryset_with_search.filter(sstate_result__gt=Task.SSTATE_NA).count(), 'Show all tasks that tried to restore ouput from the <code>sstate-cache</code> directory or mirrors'),
- ("Tasks with 'File not in cache' attempts", 'sstate_result:%d'%Task.SSTATE_MISS, queryset_with_search.filter(sstate_result=Task.SSTATE_MISS).count(), 'Show tasks that tried to restore output, but did not find it in the <code>sstate-cache</code> directory or mirrors'),
- ("Tasks with 'Failed' cache attempts", 'sstate_result:%d'%Task.SSTATE_FAILED, queryset_with_search.filter(sstate_result=Task.SSTATE_FAILED).count(), 'Show tasks that found the required output in the <code>sstate-cache</code> directory or mirrors, but could not restore it'),
- ("Tasks with 'Succeeded' cache attempts", 'sstate_result:%d'%Task.SSTATE_RESTORED, queryset_with_search.filter(sstate_result=Task.SSTATE_RESTORED).count(), 'Show tasks that successfully restored the required output from the <code>sstate-cache</code> directory or mirrors'),
- ]
- }
-
- }
- #if 'tasks' == variant: tc_cache['hidden']='0';
- tc_time={
- 'name':'Time (secs)',
- 'qhelp':'How long it took the task to finish in seconds',
- 'orderfield': _get_toggle_order(request, "elapsed_time", True),
- 'ordericon':_get_toggle_order_icon(request, "elapsed_time"),
- 'orderkey' : 'elapsed_time',
- 'clclass': 'time_taken', 'hidden' : 1,
- }
- if 'buildtime' == variant:
- tc_time['hidden']='0'
- del tc_time['clclass']
- tc_cache['hidden']='1'
-
- tc_cpu_time_system={
- 'name':'System CPU time (secs)',
- 'qhelp':'Total amount of time spent executing in kernel mode, in ' +
- 'seconds. Note that this time can be greater than the task ' +
- 'time due to parallel execution.',
- 'orderfield': _get_toggle_order(request, "cpu_time_system", True),
- 'ordericon':_get_toggle_order_icon(request, "cpu_time_system"),
- 'orderkey' : 'cpu_time_system',
- 'clclass': 'cpu_time_system', 'hidden' : 1,
- }
-
- tc_cpu_time_user={
- 'name':'User CPU time (secs)',
- 'qhelp':'Total amount of time spent executing in user mode, in seconds. ' +
- 'Note that this time can be greater than the task time due to ' +
- 'parallel execution.',
- 'orderfield': _get_toggle_order(request, "cpu_time_user", True),
- 'ordericon':_get_toggle_order_icon(request, "cpu_time_user"),
- 'orderkey' : 'cpu_time_user',
- 'clclass': 'cpu_time_user', 'hidden' : 1,
- }
-
- if 'cputime' == variant:
- tc_cpu_time_system['hidden']='0'
- tc_cpu_time_user['hidden']='0'
- del tc_cpu_time_system['clclass']
- del tc_cpu_time_user['clclass']
- tc_cache['hidden']='1'
-
- tc_diskio={
- 'name':'Disk I/O (bytes)',
- 'qhelp':'Number of bytes written to and read from the disk during the task',
- 'orderfield': _get_toggle_order(request, "disk_io", True),
- 'ordericon':_get_toggle_order_icon(request, "disk_io"),
- 'orderkey' : 'disk_io',
- 'clclass': 'disk_io', 'hidden' : 1,
- }
- if 'diskio' == variant:
- tc_diskio['hidden']='0'
- del tc_diskio['clclass']
- tc_cache['hidden']='1'
-
- build = Build.objects.get(pk=build_id)
-
- context = { 'objectname': variant,
- 'object_search_display': object_search_display,
- 'filter_search_display': filter_search_display,
- 'mainheading': title_variant,
- 'build': build,
- 'project': build.project,
- 'objects': task_objects,
- 'default_orderby' : default_orderby,
- 'search_term': search_term,
- 'total_count': queryset_with_search.count(),
- 'tablecols':[
- tc_order,
- tc_recipe,
- tc_recipe_version,
- tc_task,
- tc_executed,
- tc_outcome,
- tc_cache,
- tc_time,
- tc_cpu_time_system,
- tc_cpu_time_user,
- tc_diskio,
- ]}
-
-
- response = render(request, template, context)
- _set_parameters_values(pagesize, orderby, request)
- return response
-
-def tasks(request, build_id):
- return tasks_common(request, build_id, 'tasks', '')
-
-def tasks_task(request, build_id, task_id):
- return tasks_common(request, build_id, 'tasks', task_id)
-
-def buildtime(request, build_id):
- return tasks_common(request, build_id, 'buildtime', '')
-
-def diskio(request, build_id):
- return tasks_common(request, build_id, 'diskio', '')
-
-def cputime(request, build_id):
- return tasks_common(request, build_id, 'cputime', '')
-
def configuration(request, build_id):
template = 'configuration.html'