]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: All Tasks Feature with sorting and filtering
authorRavi Chintakunta <ravi.chintakunta@timesys.com>
Fri, 10 Jan 2014 21:43:24 +0000 (16:43 -0500)
committerAlexandru DAMIAN <alexandru.damian@intel.com>
Mon, 27 Jan 2014 15:19:50 +0000 (15:19 +0000)
- Fixed the all tasks view and template  to match the UI design and use
the new basetable code.

- Added a method to views to add sort order icon to the view context.

- Default sort order when the page is loaded is displayed with the sort icon

- Filtering of columns

Signed-off-by: Ravi Chintakunta <ravi.chintakunta@timesys.com>
lib/toaster/toastergui/templates/task.html [deleted file]
lib/toaster/toastergui/templates/tasks.html [new file with mode: 0644]
lib/toaster/toastergui/views.py

diff --git a/lib/toaster/toastergui/templates/task.html b/lib/toaster/toastergui/templates/task.html
deleted file mode 100644 (file)
index 6af2c51..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-{% extends "basebuildpage.html" %}
-
-{% block localbreadcrumb %}
-<li>Tasks</li>
-{% endblock %}
-
-{% block buildinfomain %}
-{% include "basetable_top.html" %}
-
-
-    {% if not objects %}
-        <p>No tasks were executed in this build!</p>
-    {% else %}
-
-            <tr>
-            <th>Order</th>
-            <th>Task</th>
-            <th>Recipe Version</th>
-            <th>Task Type</th>
-            <th>Checksum</th>
-            <th>Outcome</th>
-            <th>Message</th>
-            <th>Time</th>
-            <th>CPU usage</th>
-            <th>Disk I/O</th>
-            <th>Script type</th>
-            <th>Filesystem</th>
-            <th>Depends</th>
-            </tr>
-
-            {% for task in objects %}
-
-            <tr class="data">
-                <td>{{task.order}}</td>
-                <td><a name="{{task.recipe.name}}.{{task.task_name}}">
-                <a href="{% url "layer_versions_recipes" task.recipe.layer_version_id %}#{{task.recipe.name}}">{{task.recipe.name}}</a>.{{task.task_name}}</a></td>
-                <td>{{task.recipe.version}}</td>
-
-                {% if task.task_executed %}
-                <td>Executed</td>
-                {% else %}
-                <td>Prebuilt</td>
-                {% endif %}
-
-                <td>{{task.sstate_checksum}}</td>
-                <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>
-                <td><p>{{task.message}}</td>
-                <td>{{task.elapsed_time}}</td>
-                <td>{{task.cpu_usage}}</td>
-                <td>{{task.disk_io}}</td>
-                <td>{{task.get_script_type_display}}</td>
-                <td> <table>
-<tr><td>                Recipe</td><td><a target="_fileview" href="file:///{{task.recipe.file_path}}">{{task.recipe.file_path}}</a></td></tr>
-<tr><td>                Source</td><td><a target="_fileview" href="file:///{{task.file_name}}">{{task.file_name}}:{{task.line_number}}</a></td></tr>
-<tr><td>                Workdir</td><td><a target="_fileview" href="file:///{{task.work_directory}}">{{task.work_directory}}</a></td></tr>
-<tr><td>                Log</td><td><a target="_fileview" href="file:///{{task.logfile}}">{{task.logfile}}</a><br/></td></tr>
-</table>
-                </td>
-                <td>
-            <div style="height: 3em; overflow:auto">
-                {% for tt in task.task_dependencies_task.all %}
-                    <a href="#{{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}">
-                    {{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}</a><br/>
-                {% endfor %}
-            </div>
-                </td>
-                </tr>
-
-            {% endfor %}
-
-    {% endif %}
-
-{% include "basetable_bottom.html" %}
-{% endblock %}
diff --git a/lib/toaster/toastergui/templates/tasks.html b/lib/toaster/toastergui/templates/tasks.html
new file mode 100644 (file)
index 0000000..6831f10
--- /dev/null
@@ -0,0 +1,67 @@
+{% extends "basebuildpage.html" %}
+{% load projecttags %}
+{% block localbreadcrumb %}
+<li>All tasks</li>
+{% endblock %}
+
+{% block buildinfomain %}
+<div class="span10">
+<div class="page-header">
+<h1> Tasks </h1>
+</div>
+{% include "basetable_top.html" %}
+
+
+    {% if not objects %}
+        <p>No tasks were executed in this build!</p>
+    {% else %}
+            {% for task in objects %}
+            <tr {{ task|task_color }} >
+                <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>
+                </td>
+                <td class="executed">
+                    <a href="{%url "task" build.pk task.pk%} ">
+                    {% if task.task_executed %}
+                        Executed
+                    {% else %}
+                        Not executed
+                    {% endif %}
+                    </a>
+                </td>
+                <td class="outcome">
+                    <a href="{%url "task" build.pk task.pk%} ">{{task.get_outcome_display}}</a>
+                </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}}
+                </td>
+                <td class="cpu_used">
+                    {{task.cpu_usage|format_none_and_zero}}
+                </td>
+                <td class="disk_io">
+                    {{task.disk_io|format_none_and_zero}}
+                </td>
+                <td class="task_log">
+                    {{task.logfile}}
+                </td>
+            </tr>
+
+        {% endfor %}
+
+    {% endif %}
+
+{% include "basetable_bottom.html" %}
+</div>
+{% endblock %}
index 1604bb6bc43d5255fb053626a056d42f0e3a5114..ab8b938cdd9646d37cb2fc42331cbe2dcf9f22eb 100644 (file)
@@ -109,6 +109,14 @@ def _get_toggle_order(request, orderkey, reverse = False):
     else:
         return "%s:-" % orderkey if request.GET.get('orderby', "") == "%s:+" % orderkey else "%s:+" % orderkey
 
+def _get_toggle_order_icon(request, orderkey):
+    if request.GET.get('orderby', "") == "%s:+"%orderkey:
+        return "down"
+    elif request.GET.get('orderby', "") == "%s:-"%orderkey:
+        return "up"
+    else:
+        return None
+
 # we check that the input comes in a valid form that we can recognize
 def _validate_input(input, model):
 
@@ -390,8 +398,8 @@ def _find_task_provider(task):
     return None
 
 def tasks(request, build_id):
-    template = 'task.html'
-    mandatory_parameters = { 'count': 100,  'page' : 1};
+    template = 'tasks.html'
+    mandatory_parameters = { 'count': 25,  'page' : 1, 'orderby':'order:+'};
     retval = _verify_parameters( request.GET, mandatory_parameters )
     if retval:
         return _redirect_parameters( 'tasks', request.GET, mandatory_parameters, build_id = build_id)
@@ -401,11 +409,115 @@ def tasks(request, build_id):
 
     tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
 
-    for t in tasks:
-        if t.outcome == Task.OUTCOME_COVERED:
-            t.provider = _find_task_provider(t)
+# Per Belen - do not show the covering task
+#    for t in tasks:
+#        if t.outcome == Task.OUTCOME_COVERED:
+#            t.provider = _find_task_provider(t)
+
+    context = { 'objectname': 'tasks',
+                'build': Build.objects.filter(pk=build_id)[0],
+                'objects': tasks,
+                'tablecols':[
+                {
+                    'name':'Order',
+                    'qhelp':'The running sequence of each task in the build',
+                    'orderfield': _get_toggle_order(request, "order"),
+                    'ordericon':_get_toggle_order_icon(request, "order"),
+                },
+                {
+                    'name':'Recipe',
+                    'qhelp':'The name of the recipe to which each task applies',
+#                    'orderfield': _get_toggle_order(request, "recipe"),
+                    'ordericon':_get_toggle_order_icon(request, "recipe"),
+                },
+                {
+                    'name':'Recipe version',
+                    'qhelp':'The version of the recipe to which each task applies',
+                    'clclass': 'recipe_version',
+                    'hidden' : 1,
+                },
+                {
+                    'name':'Task',
+                    'qhelp':'The name of the task',
+                    'orderfield': _get_toggle_order(request, "task_name"),
+                    'ordericon':_get_toggle_order_icon(request, "task_name"),
+                },
+                {
+                    'name':'Executed',
+                    'qhelp':"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)",
+                    'orderfield': _get_toggle_order(request, "task_executed"),
+                    'ordericon':_get_toggle_order_icon(request, "task_executed"),
+                       'filter' : {
+                               'class' : 'executed',
+                               'label': 'Show:',
+                               'options' : [
+                                           ('Executed Tasks', 'task_executed:1'),
+                                           ('Not Executed Tasks', 'task_executed:0'),
+                                           ]
+                               }
+
+                },
+                {
+                    'name':'Outcome',
+                    'qhelp':'This column tells you if executed tasks succeeded, failed or restored output from the <code>sstate-cache</code> directory or mirrors. It also tells you why not executed tasks did not need to run',
+                    'orderfield': _get_toggle_order(request, "outcome"),
+                    'ordericon':_get_toggle_order_icon(request, "outcome"),
+                    'filter' : {
+                               'class' : 'outcome',
+                               'label': 'Show:',
+                               'options' : [
+                                           ('Succeeded Tasks', 'outcome:%d'%Task.OUTCOME_SUCCESS),
+                                           ('Failed Tasks', 'outcome:%d'%Task.OUTCOME_FAILED),
+                                           ('Cached Tasks', 'outcome:%d'%Task.OUTCOME_CACHED),
+                                           ('Prebuilt Tasks', 'outcome:%d'%Task.OUTCOME_PREBUILT),
+                                           ('Covered Tasks', 'outcome:%d'%Task.OUTCOME_COVERED),
+                                           ('Empty Tasks', 'outcome:%d'%Task.OUTCOME_NA),
+                                           ]
+                               }
 
-    context = {'build': Build.objects.filter(pk=build_id)[0], 'objects': tasks}
+                },
+                {
+                    '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 what was the result: Succeeded, Failed or File not in cache',
+                    'orderfield': _get_toggle_order(request, "sstate_result"),
+                    'ordericon':_get_toggle_order_icon(request, "sstate_result"),
+                    'filter' : {
+                               'class' : 'cache_attempt',
+                               'label': 'Show:',
+                               'options' : [
+                                           ('Tasks with cache attempts', 'sstate_result:%d'%Task.SSTATE_NA),
+                                           ("Tasks with 'File not in cache' attempts", 'sstate_result:%d'%Task.SSTATE_MISS),
+                                           ("Tasks with 'Failed' cache attempts", 'sstate_result:%d'%Task.SSTATE_FAILED),
+                                           ("Tasks with 'Succeeded' cache attempts", 'sstate_result:%d'%Task.SSTATE_RESTORED),
+                                           ]
+                               }
+
+                },
+                {
+                    'name':'Time (secs)',
+                    'qhelp':'How long it took the task to finish, expressed in seconds',
+                    'clclass': 'time_taken',
+                    'hidden' : 1,
+                },
+                {
+                    'name':'CPU usage',
+                    'qhelp':'Task CPU utilisation, expressed as a percentage',
+                    'clclass': 'cpu_used',
+                    'hidden' : 1,
+                },
+                {
+                    'name':'Disk I/O (ms)',
+                    'qhelp':'Number of miliseconds the task spent doing disk input and output',
+                    'clclass': 'disk_io',
+                    'hidden' : 1,
+                },
+                {
+                    'name':'Log',
+                    'qhelp':'The location in disk of the task log file',
+                    'clclass': 'task_log',
+                    'hidden' : 1,
+                },
+                ]}
 
     return render(request, template, context)