All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: Michael Wood <michael.g.wood@intel.com>, yocto@yoctoproject.org
Cc: belen.barros.pena@linux.intel.com
Subject: Re: [[PATCH][error-report-web] 5/8] Post/models.py: Build model add support for Error type.
Date: Tue, 14 Jun 2016 14:23:41 -0500	[thread overview]
Message-ID: <576059BD.4030508@linux.intel.com> (raw)
In-Reply-To: <57603458.7050601@linux.intel.com>

[-- 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 --]

  reply	other threads:[~2016-06-14 19:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576059BD.4030508@linux.intel.com \
    --to=anibal.limon@linux.intel.com \
    --cc=belen.barros.pena@linux.intel.com \
    --cc=michael.g.wood@intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.