All of lore.kernel.org
 help / color / mirror / Atom feed
* [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8
@ 2016-06-13 23:32 Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 1/8] requirements.txt: Update requeriments for use 1.8 LTS Django version Aníbal Limón
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

The next patches enables support of django 1.8 LTS (two patches) and the other
are for enable to display other type of errors not only task related ones based
on design [1].

Also the changes could be reviewed at,

http://git.yoctoproject.org/cgit/cgit.cgi/error-report-web/log/?h=alimon/devel

[1] https://bugzilla.yoctoproject.org/attachment.cgi?id=3214

Aníbal Limón (8):
  requirements.txt: Update requeriments for use 1.8 LTS Django version.
  urls.py: RedirectView, fix warnings about change of default value in
    django 1.9
  Post/models.py: Increase the TASK field length
  Post/migrations/0003_auto_20150603_0913.py: Replace tabs for spaces
  Post/models.py: Build model add support for Error type.
  Post/{models,parser}.py: Add support for receive/store error_type.
  views/templates: Add support for display different type of errors
  Post/{models,views}.py: Add FAILURE field on BuildFailure model

 Post/migrations/0003_auto_20150603_0913.py   |  6 +++---
 Post/migrations/0004_auto_20160530_1126.py   | 20 ++++++++++++++++++++
 Post/migrations/0005_build_error_type.py     | 19 +++++++++++++++++++
 Post/migrations/0006_buildfailure_failure.py | 28 ++++++++++++++++++++++++++++
 Post/models.py                               | 20 +++++++++++++++++++-
 Post/parser.py                               | 17 ++++++++++++++---
 Post/views.py                                | 17 ++++++-----------
 project/urls.py                              |  4 ++--
 requirements.txt                             |  2 +-
 templates/error-details.html                 | 13 ++++++++++++-
 templates/latest-errors.html                 | 16 ++++++++--------
 11 files changed, 132 insertions(+), 30 deletions(-)
 create mode 100644 Post/migrations/0004_auto_20160530_1126.py
 create mode 100644 Post/migrations/0005_build_error_type.py
 create mode 100644 Post/migrations/0006_buildfailure_failure.py

-- 
2.1.4



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 1/8] requirements.txt: Update requeriments for use 1.8 LTS Django version.
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 2/8] urls.py: RedirectView, fix warnings about change of default value in django 1.9 Aníbal Limón
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

[YOCTO #9733]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/requirements.txt b/requirements.txt
index 9521321..909d054 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
-Django==1.7.3
+Django<1.9
 python-Levenshtein==0.12.0
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 2/8] urls.py: RedirectView, fix warnings about change of default value in django 1.9
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 1/8] requirements.txt: Update requeriments for use 1.8 LTS Django version Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 3/8] Post/models.py: Increase the TASK field length Aníbal Limón
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

RemovedInDjango19Warning: Default value of 'RedirectView.permanent' will
change from True to False in Django 1.9. Set an explicit value to
silence this warning.
  url(r'^$', RedirectView.as_view(pattern_name="main")),

RemovedInDjango19Warning: Default value of 'RedirectView.permanent' will
change from True to False in Django 1.9. Set an explicit value to
silence this warning.
  url(r'^Errors/Search/Args/$',
RedirectView.as_view(pattern_name="Post.views.search",query_string=True),
{'mode':results_mode.SEARCH }),

[YOCTO #9733]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 project/urls.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/project/urls.py b/project/urls.py
index 7b6f643..0e8f39c 100644
--- a/project/urls.py
+++ b/project/urls.py
@@ -37,7 +37,7 @@ urlpatterns = patterns('',
     url(r'^(?i)ClientPost/JSON/$', 'Post.views.addData', { 'return_json' : True }),
     url(r'^(?i)Errors/$', 'Post.views.default', name="main"),
     url(r'^(?i)Statistics/$', TemplateView.as_view(template_name="home.html"), name = "statistics"),
-    url(r'^$', RedirectView.as_view(pattern_name="main")),
+    url(r'^$', RedirectView.as_view(pattern_name="main", permanent=True)),
     # Url for backwards compatibility with old search links
-    url(r'^Errors/Search/Args/$', RedirectView.as_view(pattern_name="Post.views.search",query_string=True), {'mode':results_mode.SEARCH }),
+    url(r'^Errors/Search/Args/$', RedirectView.as_view(pattern_name="Post.views.search",query_string=True,permanent=True), {'mode':results_mode.SEARCH }),
 )
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 3/8] Post/models.py: Increase the TASK field length
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 1/8] requirements.txt: Update requeriments for use 1.8 LTS Django version Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 2/8] urls.py: RedirectView, fix warnings about change of default value in django 1.9 Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 4/8] Post/migrations/0003_auto_20150603_0913.py: Replace tabs for spaces Aníbal Limón
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

Now bitbake exception/errors can be published into ERW so
TASK in bitbake is the command line executed.

[YOCTO #7583]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/migrations/0004_auto_20160530_1126.py | 20 ++++++++++++++++++++
 Post/models.py                             |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 Post/migrations/0004_auto_20160530_1126.py

diff --git a/Post/migrations/0004_auto_20160530_1126.py b/Post/migrations/0004_auto_20160530_1126.py
new file mode 100644
index 0000000..936454d
--- /dev/null
+++ b/Post/migrations/0004_auto_20160530_1126.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('Post', '0003_auto_20150603_0913'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='buildfailure',
+            name='TASK',
+            field=models.CharField(max_length=1024),
+            preserve_default=True,
+        ),
+    ]
diff --git a/Post/models.py b/Post/models.py
index d1bae38..84f8abf 100644
--- a/Post/models.py
+++ b/Post/models.py
@@ -27,7 +27,7 @@ class Build(models.Model):
     LINK_BACK = models.TextField(max_length=300, blank=True, null=True)
 
 class BuildFailure(models.Model):
-    TASK = models.CharField(max_length=200)
+    TASK = models.CharField(max_length=1024)
     RECIPE= models.CharField(max_length=250)
     RECIPE_VERSION = models.CharField(max_length=200)
     ERROR_DETAILS = models.TextField(max_length=int(settings.MAX_UPLOAD_SIZE))
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 4/8] Post/migrations/0003_auto_20150603_0913.py: Replace tabs for spaces
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
                   ` (2 preceding siblings ...)
  2016-06-13 23:32 ` [[PATCH][error-report-web] 3/8] Post/models.py: Increase the TASK field length Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type Aníbal Limón
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

When try to migrate using python3 it raises an exception because
found tabs inside the migration.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/migrations/0003_auto_20150603_0913.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Post/migrations/0003_auto_20150603_0913.py b/Post/migrations/0003_auto_20150603_0913.py
index 321f09f..f936883 100644
--- a/Post/migrations/0003_auto_20150603_0913.py
+++ b/Post/migrations/0003_auto_20150603_0913.py
@@ -34,9 +34,9 @@ def add_lev_distance_data(apps, schema_editor):
     while offset < count:
         objs = BuildFailure.objects.all()[offset : offset + pagesize]
         for f in objs:
-	    if f.LEV_DISTANCE is None:
-		f.LEV_DISTANCE = calc_lev_distance(f)
-	        f.save()
+            if f.LEV_DISTANCE is None:
+                f.LEV_DISTANCE = calc_lev_distance(f)
+                f.save()
 
         del objs
         offset = offset + pagesize
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type.
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
                   ` (3 preceding siblings ...)
  2016-06-13 23:32 ` [[PATCH][error-report-web] 4/8] Post/migrations/0003_auto_20150603_0913.py: Replace tabs for spaces Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-14 13:30   ` Michael Wood
  2016-06-13 23:32 ` [[PATCH][error-report-web] 6/8] Post/{models, parser}.py: Add support for receive/store error_type Aníbal Limón
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

In order to support other errors not only Recipe ones adds
a ERROR_TYPE field to the Build model defaults to "Recipe".

Add a class for store BuildErrorType currently supported
Recipe, Core, Bitbake selftest and OE selftest.

[YOCTO #7583]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/migrations/0005_build_error_type.py | 19 +++++++++++++++++++
 Post/models.py                           |  7 +++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Post/migrations/0005_build_error_type.py

diff --git a/Post/migrations/0005_build_error_type.py b/Post/migrations/0005_build_error_type.py
new file mode 100644
index 0000000..96cdf8c
--- /dev/null
+++ b/Post/migrations/0005_build_error_type.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('Post', '0004_auto_20160530_1126'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='build',
+            name='ERROR_TYPE',
+            field=models.CharField(default=b'Recipe', max_length=64),
+        ),
+    ]
diff --git a/Post/models.py b/Post/models.py
index 84f8abf..f8d9916 100644
--- a/Post/models.py
+++ b/Post/models.py
@@ -11,6 +11,12 @@ from datetime import datetime
 
 import Levenshtein
 
+class BuildErrorType(object):
+    RECIPE = "Recipe"
+    BITBAKE_CORE = "Core"
+    BITBAKE_SELFTEST = "Bitbake selftest"
+    OE_SELFTEST = "OE selftest"
+
 # Create your models here.
 class Build(models.Model):
     DATE = models.DateTimeField('Submit date', blank=True, null=True)
@@ -25,6 +31,7 @@ class Build(models.Model):
     NAME = models.CharField(max_length=50)
     EMAIL = models.CharField(max_length=50)
     LINK_BACK = models.TextField(max_length=300, blank=True, null=True)
+    ERROR_TYPE = models.CharField(max_length=64, default=BuildErrorType.RECIPE)
 
 class BuildFailure(models.Model):
     TASK = models.CharField(max_length=1024)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 6/8] Post/{models, parser}.py: Add support for receive/store error_type.
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
                   ` (4 preceding siblings ...)
  2016-06-13 23:32 ` [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 7/8] views/templates: Add support for display different type of errors Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 8/8] Post/{models, views}.py: Add FAILURE field on BuildFailure model Aníbal Limón
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

For compatibility reasons if error_type isn't specified in the JSON
payload use BuildErrorType.RECIPE by default.

[YOCTO #7584]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/models.py | 10 ++++++++++
 Post/parser.py | 11 +++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Post/models.py b/Post/models.py
index f8d9916..bec2abd 100644
--- a/Post/models.py
+++ b/Post/models.py
@@ -17,6 +17,16 @@ class BuildErrorType(object):
     BITBAKE_SELFTEST = "Bitbake selftest"
     OE_SELFTEST = "OE selftest"
 
+    @staticmethod
+    def is_supported(error_type):
+        if error_type == BuildErrorType.RECIPE or \
+                error_type == BuildErrorType.BITBAKE_CORE or \
+                error_type == BuildErrorType.BITBAKE_SELFTEST or \
+                error_type == BuildErrorType.OE_SELFTEST:
+            return True
+
+        return False
+
 # Create your models here.
 class Build(models.Model):
     DATE = models.DateTimeField('Submit date', blank=True, null=True)
diff --git a/Post/parser.py b/Post/parser.py
index 599afde..295870f 100644
--- a/Post/parser.py
+++ b/Post/parser.py
@@ -8,7 +8,7 @@
 # Licensed under the MIT license, see COPYING.MIT for details
 
 import json, re
-from Post.models import Build, BuildFailure
+from Post.models import Build, BuildFailure, BuildErrorType
 from django.conf import settings
 from django.utils import timezone
 from django.core.urlresolvers import reverse
@@ -40,6 +40,7 @@ class Parser:
         if self.contains_tags(jsondata) == True:
             return  { 'error' : 'Invalid characters in json' }
 
+        error_desc = ""
         b = Build.objects.create()
         try:
             b.MACHINE = str(jsondata['machine'])
@@ -53,6 +54,12 @@ class Parser:
             b.EMAIL = str(jsondata['email'])
             b.LINK_BACK = jsondata.get("link_back", None)
 
+            error_type = jsondata.get("error_type", None) or BuildErrorType.RECIPE
+            if not BuildErrorType.is_supported(error_type):
+                error_desc = "Unsupported error_type %s" % error_type
+                raise ""
+            b.ERROR_TYPE = error_type
+
             # Extract the branch and commit
             g = re.match(r'(.*): (.*)', jsondata['branch_commit'])
 
@@ -68,7 +75,7 @@ class Parser:
             b.save()
             failures = jsondata['failures']
         except:
-            return { 'error' : "Problem reading json payload" }
+            return { 'error' : "Problem reading json payload, %s" % error_desc }
 
         for fail in failures:
             if len(fail) > int(settings.MAX_UPLOAD_SIZE):
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 7/8] views/templates: Add support for display different type of errors
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
                   ` (5 preceding siblings ...)
  2016-06-13 23:32 ` [[PATCH][error-report-web] 6/8] Post/{models, parser}.py: Add support for receive/store error_type Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  2016-06-13 23:32 ` [[PATCH][error-report-web] 8/8] Post/{models, views}.py: Add FAILURE field on BuildFailure model Aníbal Limón
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

Now we have a set of different type of errors not only Recipe ones
this change enable support for display it based on design did by
Belen Barros [1].

[YOCTO #7583]

[1] https://bugzilla.yoctoproject.org/attachment.cgi?id=3214

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/views.py                | 16 +++++-----------
 templates/error-details.html | 13 ++++++++++++-
 templates/latest-errors.html | 19 +++++++++++--------
 3 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/Post/views.py b/Post/views.py
index 0455baa..6b57977 100644
--- a/Post/views.py
+++ b/Post/views.py
@@ -134,18 +134,13 @@ def search(request, mode=results_mode.LATEST, **kwargs):
          'field' : 'BUILD__DATE',
          'disable_toggle' : True,
         },
-        {'name': 'Recipe',
-         'clclass' : 'recipe',
-         'field' : 'RECIPE',
+        {'name': 'Error type',
+         'clclass' : 'error_type',
+         'field' : 'BUILD__ERROR_TYPE',
          'disable_toggle' : True,
         },
-        {'name': 'Recipe version',
-         'clclass': 'recipe_version',
-         'field' : 'RECIPE_VERSION',
-        },
-        {'name': 'Task',
-         'clclass': 'task',
-         'field' : 'TASK',
+        {'name': 'Failure',
+         'clclass': 'failure',
          'disable_toggle' : True,
         },
         {'name': 'Machine',
@@ -156,7 +151,6 @@ def search(request, mode=results_mode.LATEST, **kwargs):
         {'name': 'Distro',
          'clclass': 'distro',
          'field': 'BUILD__DISTRO',
-         'disable_toggle' : True,
         },
         {'name': 'Build system',
          'clclass': 'build_sys',
diff --git a/templates/error-details.html b/templates/error-details.html
index 62ec75f..e5bf758 100644
--- a/templates/error-details.html
+++ b/templates/error-details.html
@@ -9,7 +9,11 @@
     <a class="btn pull-left back-btn" style="margin-top:7px;" href="#">
       <i class="icon-arrow-left"></i>
     </a>
-    <h1 style="margin-left:60px;">{{detail.RECIPE}}-{{detail.RECIPE_VERSION}} {{detail.TASK}} </h1>
+    <h1 style="margin-left:60px;">
+        {% if detail.BUILD.ERROR_TYPE == "Recipe" %}
+        {{detail.RECIPE}}-{{detail.RECIPE_VERSION}}
+        {% endif %}
+        {{detail.TASK}} </h1>
   </div>
   <div class="row span8">
     <pre>{{detail.ERROR_DETAILS}}</pre>
@@ -20,12 +24,19 @@
       <dl class="dl-vertical">
         <dt>Submitted on:</dt>
         <dd>{{ detail.BUILD.DATE|date:"d/m/y H:i"}}</dd>
+        <dt>Error type:</dt>
+        <dd>{{ detail.BUILD.ERROR_TYPE }}</dd>
+        {% if detail.BUILD.ERROR_TYPE == "Recipe" %}
         <dt>Task:</dt>
         <dd>{{ detail.TASK }}</dd>
         <dt>Recipe:</dt>
         <dd>{{detail.RECIPE }} </dd>
         <dt>Recipe version:</dt>
         <dd>{{ detail.RECIPE_VERSION }}</dd>
+        {% else %}
+        <dt>Command:</dt>
+        <dd>{{ detail.TASK }}</dd>
+        {% endif %}
         <dt>Machine:</dt>
         <dd>{{ detail.BUILD.MACHINE }}</dd>
         <dt>Distro:</dt>
diff --git a/templates/latest-errors.html b/templates/latest-errors.html
index 56f612a..77a54af 100644
--- a/templates/latest-errors.html
+++ b/templates/latest-errors.html
@@ -127,18 +127,21 @@
               {% url "details" build_fail.id as details_url %}
               <tr class="data">
                 <td class="submitted_on"> <a href="{{details_url}}">{{ build_fail.BUILD.DATE|date:"d/m/y H:i"}}</a></td>
-                <td class="recipe"><a href="{{details_url}}">{{ build_fail.RECIPE }}</a>
-                  <a class="filter" href="#" data-filter="{{build_fail.RECIPE}}" data-type="recipe">
-                    <i class="icon-filter hover" title="Filter by {{build_fail.RECIPE}}"></i>
+
+                <td class="error_type"><a href="{{details_url}}">{{ build_fail.BUILD.ERROR_TYPE }}</a>
+                  <a class="filter" href="#" data-filter="{{build_fail.BUILD.ERROR_TYPE}}" data-type="error_type">
+                    <i class="icon-filter hover" title="Filter by {{build_fail.BUILD.ERROR_TYPE}}"></i>
                   </a>
                 </td>
-                <td class="recipe_version"><a href="{{details_url}}" {% if build_fail.RECIPE_VERSION|length > 13 %}class="tooltip-me" data-toggle="tooltip" title="{{ build_fail.RECIPE_VERSION }}"{%endif%}>{{ build_fail.RECIPE_VERSION|truncatechars:13 }}</a></td>
-                <td class="task"><a href="{{details_url}}">{{ build_fail.TASK }}</a>
-                  <a class="filter"  href="#" data-filter="{{build_fail.TASK}}" data-type="task">
-                    <i class="icon-filter hover" title="Filter by {{build_fail.TASK}}"></i>
-                  </a>
 
+                <td class="failure">
+                    <a href="{{details_url}}">
+                        {% if build_fail.BUILD.ERROR_TYPE == "Recipe" %}
+                        {{ build_fail.RECIPE }}:
+                        {% endif %}
+                        {{ build_fail.TASK }}</a>
                 </td>
+
                 <td class="machine"><a href="{{details_url}}">{{ build_fail.BUILD.MACHINE }}</a>
                   <a class="filter"  href="#" data-filter="{{build_fail.BUILD.MACHINE}}" data-type="machine">
                     <i class="icon-filter hover" title="Filter by {{build_fail.BUILD.MACHINE}}"></i>
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [[PATCH][error-report-web] 8/8] Post/{models, views}.py: Add FAILURE field on BuildFailure model
  2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
                   ` (6 preceding siblings ...)
  2016-06-13 23:32 ` [[PATCH][error-report-web] 7/8] views/templates: Add support for display different type of errors Aníbal Limón
@ 2016-06-13 23:32 ` Aníbal Limón
  7 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-13 23:32 UTC (permalink / raw)
  To: yocto; +Cc: belen.barros.pena

In order to support filters using django Paginator adds a FAILURE
field by default contains "RECIPE: TASK" when ERROR_TYPE is Recipe
instead contains only "TASK".

[YOCTO #7583]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 Post/migrations/0006_buildfailure_failure.py | 28 ++++++++++++++++++++++++++++
 Post/models.py                               |  1 +
 Post/parser.py                               |  6 +++++-
 Post/views.py                                |  1 +
 templates/latest-errors.html                 |  5 +----
 5 files changed, 36 insertions(+), 5 deletions(-)
 create mode 100644 Post/migrations/0006_buildfailure_failure.py

diff --git a/Post/migrations/0006_buildfailure_failure.py b/Post/migrations/0006_buildfailure_failure.py
new file mode 100644
index 0000000..b3e30bf
--- /dev/null
+++ b/Post/migrations/0006_buildfailure_failure.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+def populate_failure(apps, schema_editor):
+    model = apps.get_model("Post", "BuildFailure")
+    for build_failure in model.objects.all():
+        if build_failure.BUILD.ERROR_TYPE == "Recipe":
+            build_failure.FAILURE = "%s: %s" \
+                    (build_failure.RECIPE, build_failure.TASK)
+        else:
+            build_failure.FAILURE = build_failure.TASK
+        build_failure.save()
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('Post', '0005_build_error_type'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='buildfailure',
+            name='FAILURE',
+            field=models.CharField(max_length=1024, blank=True),
+        ),
+        migrations.RunPython(populate_failure)
+    ]
diff --git a/Post/models.py b/Post/models.py
index bec2abd..07694fe 100644
--- a/Post/models.py
+++ b/Post/models.py
@@ -50,6 +50,7 @@ class BuildFailure(models.Model):
     ERROR_DETAILS = models.TextField(max_length=int(settings.MAX_UPLOAD_SIZE))
     BUILD = models.ForeignKey(Build)
     LEV_DISTANCE = models.IntegerField(blank=True, null=True)
+    FAILURE = models.CharField(max_length=1024, blank=True)
 
     def get_similar_fails(self):
         if self.LEV_DISTANCE is None:
diff --git a/Post/parser.py b/Post/parser.py
index 295870f..2ef35c1 100644
--- a/Post/parser.py
+++ b/Post/parser.py
@@ -92,7 +92,11 @@ class Parser:
                 recipe = package
                 recipe_version = "unknown"
 
-            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = fail['log'].encode('utf-8'), BUILD = b)
+            if b.ERROR_TYPE = "Recipe":
+                failure = "%s: %s" % (recipe, str(fail['task']))
+            else:
+                failure = str(fail['task'])
+            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = fail['log'].encode('utf-8'), BUILD = b, FAILURE = failure)
 
             f.save()
 
diff --git a/Post/views.py b/Post/views.py
index 6b57977..41f0e2b 100644
--- a/Post/views.py
+++ b/Post/views.py
@@ -141,6 +141,7 @@ def search(request, mode=results_mode.LATEST, **kwargs):
         },
         {'name': 'Failure',
          'clclass': 'failure',
+         'field' : 'FAILURE',
          'disable_toggle' : True,
         },
         {'name': 'Machine',
diff --git a/templates/latest-errors.html b/templates/latest-errors.html
index 77a54af..a4418b5 100644
--- a/templates/latest-errors.html
+++ b/templates/latest-errors.html
@@ -136,10 +136,7 @@
 
                 <td class="failure">
                     <a href="{{details_url}}">
-                        {% if build_fail.BUILD.ERROR_TYPE == "Recipe" %}
-                        {{ build_fail.RECIPE }}:
-                        {% endif %}
-                        {{ build_fail.TASK }}</a>
+                        {{ build_fail.FAILURE }}</a>
                 </td>
 
                 <td class="machine"><a href="{{details_url}}">{{ build_fail.BUILD.MACHINE }}</a>
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type.
  2016-06-13 23:32 ` [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type Aníbal Limón
@ 2016-06-14 13:30   ` Michael Wood
  2016-06-14 16:44     ` Aníbal Limón
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Wood @ 2016-06-14 13:30 UTC (permalink / raw)
  To: Aníbal Limón, yocto; +Cc: belen.barros.pena

On 14/06/16 00:32, Aníbal Limón wrote:
> In order to support other errors not only Recipe ones adds
> a ERROR_TYPE field to the Build model defaults to "Recipe".
>
> Add a class for store BuildErrorType currently supported
> Recipe, Core, Bitbake selftest and OE selftest.
>
> [YOCTO #7583]
>
> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
> ---
>   Post/migrations/0005_build_error_type.py | 19 +++++++++++++++++++
>   Post/models.py                           |  7 +++++++
>   2 files changed, 26 insertions(+)
>   create mode 100644 Post/migrations/0005_build_error_type.py
>
> diff --git a/Post/migrations/0005_build_error_type.py b/Post/migrations/0005_build_error_type.py
> new file mode 100644
> index 0000000..96cdf8c
> --- /dev/null
> +++ b/Post/migrations/0005_build_error_type.py
> @@ -0,0 +1,19 @@
> +# -*- coding: utf-8 -*-
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('Post', '0004_auto_20160530_1126'),
> +    ]
> +
> +    operations = [
> +        migrations.AddField(
> +            model_name='build',
> +            name='ERROR_TYPE',
> +            field=models.CharField(default=b'Recipe', max_length=64),
> +        ),
> +    ]
> diff --git a/Post/models.py b/Post/models.py
> index 84f8abf..f8d9916 100644
> --- a/Post/models.py
> +++ b/Post/models.py
> @@ -11,6 +11,12 @@ from datetime import datetime
>   
>   import Levenshtein
>   
> +class BuildErrorType(object):
> +    RECIPE = "Recipe"
> +    BITBAKE_CORE = "Core"
> +    BITBAKE_SELFTEST = "Bitbake selftest"
> +    OE_SELFTEST = "OE selftest"
> +
>   # Create your models here.
>   class Build(models.Model):
>       DATE = models.DateTimeField('Submit date', blank=True, null=True)
> @@ -25,6 +31,7 @@ class Build(models.Model):
>       NAME = models.CharField(max_length=50)
>       EMAIL = models.CharField(max_length=50)
>       LINK_BACK = models.TextField(max_length=300, blank=True, null=True)
> +    ERROR_TYPE = models.CharField(max_length=64, default=BuildErrorType.RECIPE)
>   
>   class BuildFailure(models.Model):
>       TASK = models.CharField(max_length=1024)

Thanks for the patches.

Ideally we wouldn't use a char field here as if the type string ever 
changed the database could end up with multiple versions of the type 
strings depending on when the type was saved, it would be possible to 
handle that with migrations but it would be pretty messy. It also allows 
any arbitrary chars which we probably don't want if it's something we're 
going to be filtering on.  Here is an example from Toaster on how it can 
be done with the choices option and an enum style.

|OUTCOME_NA = -1 OUTCOME_SUCCESS = 0 OUTCOME_COVERED = 1 OUTCOME_CACHED = 
2 OUTCOME_PREBUILT = 3 OUTCOME_FAILED = 4 OUTCOME_EMPTY = 5 TASK_OUTCOME 
= ( (OUTCOME_NA, 'Not Available'), (OUTCOME_SUCCESS, 'Succeeded'), 
(OUTCOME_COVERED, 'Covered'), (OUTCOME_CACHED, 'Cached'), 
(OUTCOME_PREBUILT, 'Prebuilt'), (OUTCOME_FAILED, 'Failed'), 
(OUTCOME_EMPTY, 'Empty'), ) ||outcome = models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)|



Michael



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type.
  2016-06-14 13:30   ` Michael Wood
@ 2016-06-14 16:44     ` Aníbal Limón
  2016-06-14 19:23       ` Aníbal Limón
  0 siblings, 1 reply; 12+ messages in thread
From: Aníbal Limón @ 2016-06-14 16:44 UTC (permalink / raw)
  To: Michael Wood, yocto; +Cc: belen.barros.pena

[-- Attachment #1: Type: text/plain, Size: 3502 bytes --]



On 06/14/2016 08:30 AM, Michael Wood wrote:
> On 14/06/16 00:32, Aníbal Limón wrote:
>> In order to support other errors not only Recipe ones adds
>> a ERROR_TYPE field to the Build model defaults to "Recipe".
>>
>> Add a class for store BuildErrorType currently supported
>> Recipe, Core, Bitbake selftest and OE selftest.
>>
>> [YOCTO #7583]
>>
>> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
>> ---
>>   Post/migrations/0005_build_error_type.py | 19 +++++++++++++++++++
>>   Post/models.py                           |  7 +++++++
>>   2 files changed, 26 insertions(+)
>>   create mode 100644 Post/migrations/0005_build_error_type.py
>>
>> diff --git a/Post/migrations/0005_build_error_type.py
>> b/Post/migrations/0005_build_error_type.py
>> new file mode 100644
>> index 0000000..96cdf8c
>> --- /dev/null
>> +++ b/Post/migrations/0005_build_error_type.py
>> @@ -0,0 +1,19 @@
>> +# -*- coding: utf-8 -*-
>> +from __future__ import unicode_literals
>> +
>> +from django.db import migrations, models
>> +
>> +
>> +class Migration(migrations.Migration):
>> +
>> +    dependencies = [
>> +        ('Post', '0004_auto_20160530_1126'),
>> +    ]
>> +
>> +    operations = [
>> +        migrations.AddField(
>> +            model_name='build',
>> +            name='ERROR_TYPE',
>> +            field=models.CharField(default=b'Recipe', max_length=64),
>> +        ),
>> +    ]
>> diff --git a/Post/models.py b/Post/models.py
>> index 84f8abf..f8d9916 100644
>> --- a/Post/models.py
>> +++ b/Post/models.py
>> @@ -11,6 +11,12 @@ from datetime import datetime
>>     import Levenshtein
>>   +class BuildErrorType(object):
>> +    RECIPE = "Recipe"
>> +    BITBAKE_CORE = "Core"
>> +    BITBAKE_SELFTEST = "Bitbake selftest"
>> +    OE_SELFTEST = "OE selftest"
>> +
>>   # Create your models here.
>>   class Build(models.Model):
>>       DATE = models.DateTimeField('Submit date', blank=True, null=True)
>> @@ -25,6 +31,7 @@ class Build(models.Model):
>>       NAME = models.CharField(max_length=50)
>>       EMAIL = models.CharField(max_length=50)
>>       LINK_BACK = models.TextField(max_length=300, blank=True, null=True)
>> +    ERROR_TYPE = models.CharField(max_length=64,
>> default=BuildErrorType.RECIPE)
>>     class BuildFailure(models.Model):
>>       TASK = models.CharField(max_length=1024)
> 
> Thanks for the patches.
> 
> Ideally we wouldn't use a char field here as if the type string ever
> changed the database could end up with multiple versions of the type
> strings depending on when the type was saved, it would be possible to
> handle that with migrations but it would be pretty messy. It also allows
> any arbitrary chars which we probably don't want if it's something we're
> going to be filtering on.  Here is an example from Toaster on how it can
> be done with the choices option and an enum style.
> 
> |OUTCOME_NA = -1 OUTCOME_SUCCESS = 0 OUTCOME_COVERED = 1 OUTCOME_CACHED
> = 2 OUTCOME_PREBUILT = 3 OUTCOME_FAILED = 4 OUTCOME_EMPTY = 5
> TASK_OUTCOME = ( (OUTCOME_NA, 'Not Available'), (OUTCOME_SUCCESS,
> 'Succeeded'), (OUTCOME_COVERED, 'Covered'), (OUTCOME_CACHED, 'Cached'),
> (OUTCOME_PREBUILT, 'Prebuilt'), (OUTCOME_FAILED, 'Failed'),
> (OUTCOME_EMPTY, 'Empty'), ) ||outcome =
> models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)|
> 

Thanks for the feedback, i'll change to use choices instead of char values.

	alimon

> 
> 
> Michael
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type.
  2016-06-14 16:44     ` Aníbal Limón
@ 2016-06-14 19:23       ` Aníbal Limón
  0 siblings, 0 replies; 12+ messages in thread
From: Aníbal Limón @ 2016-06-14 19:23 UTC (permalink / raw)
  To: Michael Wood, yocto; +Cc: belen.barros.pena

[-- Attachment #1: Type: text/plain, Size: 3798 bytes --]



On 06/14/2016 11:44 AM, Aníbal Limón wrote:
> 
> 
> On 06/14/2016 08:30 AM, Michael Wood wrote:
>> On 14/06/16 00:32, Aníbal Limón wrote:
>>> In order to support other errors not only Recipe ones adds
>>> a ERROR_TYPE field to the Build model defaults to "Recipe".
>>>
>>> Add a class for store BuildErrorType currently supported
>>> Recipe, Core, Bitbake selftest and OE selftest.
>>>
>>> [YOCTO #7583]
>>>
>>> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
>>> ---
>>>   Post/migrations/0005_build_error_type.py | 19 +++++++++++++++++++
>>>   Post/models.py                           |  7 +++++++
>>>   2 files changed, 26 insertions(+)
>>>   create mode 100644 Post/migrations/0005_build_error_type.py
>>>
>>> diff --git a/Post/migrations/0005_build_error_type.py
>>> b/Post/migrations/0005_build_error_type.py
>>> new file mode 100644
>>> index 0000000..96cdf8c
>>> --- /dev/null
>>> +++ b/Post/migrations/0005_build_error_type.py
>>> @@ -0,0 +1,19 @@
>>> +# -*- coding: utf-8 -*-
>>> +from __future__ import unicode_literals
>>> +
>>> +from django.db import migrations, models
>>> +
>>> +
>>> +class Migration(migrations.Migration):
>>> +
>>> +    dependencies = [
>>> +        ('Post', '0004_auto_20160530_1126'),
>>> +    ]
>>> +
>>> +    operations = [
>>> +        migrations.AddField(
>>> +            model_name='build',
>>> +            name='ERROR_TYPE',
>>> +            field=models.CharField(default=b'Recipe', max_length=64),
>>> +        ),
>>> +    ]
>>> diff --git a/Post/models.py b/Post/models.py
>>> index 84f8abf..f8d9916 100644
>>> --- a/Post/models.py
>>> +++ b/Post/models.py
>>> @@ -11,6 +11,12 @@ from datetime import datetime
>>>     import Levenshtein
>>>   +class BuildErrorType(object):
>>> +    RECIPE = "Recipe"
>>> +    BITBAKE_CORE = "Core"
>>> +    BITBAKE_SELFTEST = "Bitbake selftest"
>>> +    OE_SELFTEST = "OE selftest"
>>> +
>>>   # Create your models here.
>>>   class Build(models.Model):
>>>       DATE = models.DateTimeField('Submit date', blank=True, null=True)
>>> @@ -25,6 +31,7 @@ class Build(models.Model):
>>>       NAME = models.CharField(max_length=50)
>>>       EMAIL = models.CharField(max_length=50)
>>>       LINK_BACK = models.TextField(max_length=300, blank=True, null=True)
>>> +    ERROR_TYPE = models.CharField(max_length=64,
>>> default=BuildErrorType.RECIPE)
>>>     class BuildFailure(models.Model):
>>>       TASK = models.CharField(max_length=1024)
>>
>> Thanks for the patches.
>>
>> Ideally we wouldn't use a char field here as if the type string ever
>> changed the database could end up with multiple versions of the type
>> strings depending on when the type was saved, it would be possible to
>> handle that with migrations but it would be pretty messy. It also allows
>> any arbitrary chars which we probably don't want if it's something we're
>> going to be filtering on.  Here is an example from Toaster on how it can
>> be done with the choices option and an enum style.
>>
>> |OUTCOME_NA = -1 OUTCOME_SUCCESS = 0 OUTCOME_COVERED = 1 OUTCOME_CACHED
>> = 2 OUTCOME_PREBUILT = 3 OUTCOME_FAILED = 4 OUTCOME_EMPTY = 5
>> TASK_OUTCOME = ( (OUTCOME_NA, 'Not Available'), (OUTCOME_SUCCESS,
>> 'Succeeded'), (OUTCOME_COVERED, 'Covered'), (OUTCOME_CACHED, 'Cached'),
>> (OUTCOME_PREBUILT, 'Prebuilt'), (OUTCOME_FAILED, 'Failed'),
>> (OUTCOME_EMPTY, 'Empty'), ) ||outcome =
>> models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)|
>>
> 
> Thanks for the feedback, i'll change to use choices instead of char values.
> 
> 	alimon

I made the change now is at contrib branch,

http://git.yoctoproject.org/cgit/cgit.cgi/error-report-web/log/?h=alimon/devel

	alimon

> 
>>
>>
>> Michael
>>
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-06-14 19:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 23:32 [[PATCH][error-report-web] 0/8] Allow other type of errors and django 1.8 Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 1/8] requirements.txt: Update requeriments for use 1.8 LTS Django version Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 2/8] urls.py: RedirectView, fix warnings about change of default value in django 1.9 Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 3/8] Post/models.py: Increase the TASK field length Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 4/8] Post/migrations/0003_auto_20150603_0913.py: Replace tabs for spaces Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type Aníbal Limón
2016-06-14 13:30   ` Michael Wood
2016-06-14 16:44     ` Aníbal Limón
2016-06-14 19:23       ` Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 6/8] Post/{models, parser}.py: Add support for receive/store error_type Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 7/8] views/templates: Add support for display different type of errors Aníbal Limón
2016-06-13 23:32 ` [[PATCH][error-report-web] 8/8] Post/{models, views}.py: Add FAILURE field on BuildFailure model Aníbal Limón

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.