Track work items and generate burndown charts

Merge lp:~mabac/launchpad-work-items-tracker/better-error-contacts into lp:~linaro-automation/launchpad-work-items-tracker/linaro

Proposed by Mattias Backman on 2012-02-03
Status: Merged
Merged at revision: 331
Proposed branch: lp:~mabac/launchpad-work-items-tracker/better-error-contacts
Merge into: lp:~linaro-automation/launchpad-work-items-tracker/linaro
Diff against target: 75 lines (+22/-12) 2 files modified
To merge this branch: bzr merge lp:~mabac/launchpad-work-items-tracker/better-error-contacts
Reviewer Review Type Date Requested Status
Linaro Infrastructure 2012-02-03 Pending
Review via email: mp+91410@code.launchpad.net

Description of the Change

Hi,

This branch changes the format of the config file so that we specify contacts for receiving error emails per project.

The current way is to match a blueprint name with a regexp from the config file to find out where to send those emails. This does miss quite a few errors which we instead see in the log files and email to the Infrastructure errors list.

There is a corresponding config file in lp:~mabac/launchpad-work-items-tracker/better-config

Thanks,

Mattias

To post a comment you must log in.
Guilherme Salgado (salgado) wrote :

Yay! Thanks for working on this, Mattias.

On 03/02/12 08:05, Mattias Backman wrote:
>
> === modified file 'collect'
> --- collect 2011-12-15 18:37:53 +0000
> +++ collect 2012-02-03 11:04:28 +0000
> @@ -667,9 +667,10 @@
> def send_error_mails(cfg):
> '''Send data_errors to contacts.
>
> - Data error contacts are defined in the configuration in the "error_contact"
> - map (which assigns a regexp over spec names to a list of email addresses).
> - If no match is found, the error goes to stderr.
> + Data error contacts are defined in the configuration in the
> + "project_notification_addresses" map (which assigns project names to a list
> + of email addresses). If no address list for a project is found, the error
> + goes to stderr.

I wonder if we should make the contact address required...

The rest looks pretty good; can't wait to stop receiving all those
warnings on infra-errors!

Mattias Backman (mabac) wrote :

On Fri, Feb 3, 2012 at 1:52 PM, Guilherme Salgado
<email address hidden> wrote:
> Yay!  Thanks for working on this, Mattias.

No problem. I'm also tired of getting spam about typos. ;)

>
> On 03/02/12 08:05, Mattias Backman wrote:
>>
>> === modified file 'collect'
>> --- collect   2011-12-15 18:37:53 +0000
>> +++ collect   2012-02-03 11:04:28 +0000
>> @@ -667,9 +667,10 @@
>>  def send_error_mails(cfg):
>>      '''Send data_errors to contacts.
>>
>> -    Data error contacts are defined in the configuration in the "error_contact"
>> -    map (which assigns a regexp over spec names to a list of email addresses).
>> -    If no match is found, the error goes to stderr.
>> +    Data error contacts are defined in the configuration in the
>> +    "project_notification_addresses" map (which assigns project names to a list
>> +    of email addresses). If no address list for a project is found, the error
>> +    goes to stderr.
>
> I wonder if we should make the contact address required...

Umm, yes we shouldn't have project groups without contact addresses.
But I'd hate to break the update because of a bad config, so I'd
prefer not to bail on it. Do you think we can handle this when
reviewing config changes?

>
> The rest looks pretty good; can't wait to stop receiving all those
> warnings on infra-errors!
>
>
> --
> https://code.launchpad.net/~mabac/launchpad-work-items-tracker/better-error-contacts/+merge/91410
> You are the owner of lp:~mabac/launchpad-work-items-tracker/better-error-contacts.

Guilherme Salgado (salgado) wrote :

On 03/02/12 11:28, Mattias Backman wrote:
> On Fri, Feb 3, 2012 at 1:52 PM, Guilherme Salgado
> <email address hidden> wrote:
>> Yay! Thanks for working on this, Mattias.
>
> No problem. I'm also tired of getting spam about typos. ;)
>
>>
>> On 03/02/12 08:05, Mattias Backman wrote:
>>>
>>> === modified file 'collect'
>>> --- collect 2011-12-15 18:37:53 +0000
>>> +++ collect 2012-02-03 11:04:28 +0000
>>> @@ -667,9 +667,10 @@
>>> def send_error_mails(cfg):
>>> '''Send data_errors to contacts.
>>>
>>> - Data error contacts are defined in the configuration in the "error_contact"
>>> - map (which assigns a regexp over spec names to a list of email addresses).
>>> - If no match is found, the error goes to stderr.
>>> + Data error contacts are defined in the configuration in the
>>> + "project_notification_addresses" map (which assigns project names to a list
>>> + of email addresses). If no address list for a project is found, the error
>>> + goes to stderr.
>>
>> I wonder if we should make the contact address required...
>
> Umm, yes we shouldn't have project groups without contact addresses.
> But I'd hate to break the update because of a bad config, so I'd
> prefer not to bail on it. Do you think we can handle this when
> reviewing config changes?

We don't have config changes too often, do we? And in most cases I've
seen they'd be just a matter of extending the list of projects of an
existing class, so wouldn't break anything. We could also add a small
test script to the config branch, just to do some sanity checking, but
that we can probably save for later.

Mattias Backman (mabac) wrote :

On Fri, Feb 3, 2012 at 3:52 PM, Guilherme Salgado
<email address hidden> wrote:
> On 03/02/12 11:28, Mattias Backman wrote:
>> On Fri, Feb 3, 2012 at 1:52 PM, Guilherme Salgado
>> <email address hidden> wrote:
>>> Yay!  Thanks for working on this, Mattias.
>>
>> No problem. I'm also tired of getting spam about typos. ;)
>>
>>>
>>> On 03/02/12 08:05, Mattias Backman wrote:
>>>>
>>>> === modified file 'collect'
>>>> --- collect   2011-12-15 18:37:53 +0000
>>>> +++ collect   2012-02-03 11:04:28 +0000
>>>> @@ -667,9 +667,10 @@
>>>>  def send_error_mails(cfg):
>>>>      '''Send data_errors to contacts.
>>>>
>>>> -    Data error contacts are defined in the configuration in the "error_contact"
>>>> -    map (which assigns a regexp over spec names to a list of email addresses).
>>>> -    If no match is found, the error goes to stderr.
>>>> +    Data error contacts are defined in the configuration in the
>>>> +    "project_notification_addresses" map (which assigns project names to a list
>>>> +    of email addresses). If no address list for a project is found, the error
>>>> +    goes to stderr.
>>>
>>> I wonder if we should make the contact address required...
>>
>> Umm, yes we shouldn't have project groups without contact addresses.
>> But I'd hate to break the update because of a bad config, so I'd
>> prefer not to bail on it. Do you think we can handle this when
>> reviewing config changes?
>
> We don't have config changes too often, do we?  And in most cases I've
> seen they'd be just a matter of extending the list of projects of an
> existing class, so wouldn't break anything. We could also add a small
> test script to the config branch, just to do some sanity checking, but
> that we can probably save for later.

I was actually thinking that we should have some validator script.
Didn't have time to add that now though.

We're testing the changes on staging atm:
http://status.linaro.org/staging/update.log.txt

>
>
> --
> https://code.launchpad.net/~mabac/launchpad-work-items-tracker/better-error-contacts/+merge/91410
> You are the owner of lp:~mabac/launchpad-work-items-tracker/better-error-contacts.

Preview Diff

1=== modified file 'collect'
2--- collect 2011-12-15 18:37:53 +0000
3+++ collect 2012-02-03 11:04:28 +0000
4@@ -667,9 +667,10 @@
5 def send_error_mails(cfg):
6 '''Send data_errors to contacts.
7
8- Data error contacts are defined in the configuration in the "error_contact"
9- map (which assigns a regexp over spec names to a list of email addresses).
10- If no match is found, the error goes to stderr.
11+ Data error contacts are defined in the configuration in the
12+ "project_notification_addresses" map (which assigns project names to a list
13+ of email addresses). If no address list for a project is found, the error
14+ goes to stderr.
15 '''
16 global error_collector
17
18@@ -678,15 +679,14 @@
19
20 dbg('mailing %i data errors' % len(error_collector.errors))
21 for error in error_collector.errors:
22- for pattern, addresses in cfg['error_contact'].iteritems():
23- if (error.get_blueprint_name() is not None
24- and re.search(pattern, error.get_blueprint_name())):
25- dbg('spec %s matches error_contact pattern "%s", mailing to %s' % (error.get_blueprint_name(),
26- pattern, ', '.join(addresses)))
27- for a in addresses:
28- emails.setdefault(a, '')
29- emails[a] += error.format_for_display() + '\n'
30- break
31+ project_name = error.get_project_name()
32+ if project_name is not None:
33+ addresses = cfg['project_notification_addresses'][project_name]
34+ dbg('spec %s is targetted to "%s", mailing to %s' % (error.get_blueprint_name(),
35+ project_name, ', '.join(addresses)))
36+ for a in addresses:
37+ emails.setdefault(a, '')
38+ emails[a] += error.format_for_display() + '\n'
39 else:
40 print >> sys.stderr, error.format_for_display(), '(no error_contact pattern)'
41
42
43=== modified file 'lpworkitems/error_collector.py'
44--- lpworkitems/error_collector.py 2011-06-08 19:30:24 +0000
45+++ lpworkitems/error_collector.py 2012-02-03 11:04:28 +0000
46@@ -48,6 +48,10 @@
47 """Get the name of the blueprint, or None if not a blueprint."""
48 return None
49
50+ def get_project_name(self):
51+ """Get the name of the project, or None if not a project."""
52+ return None
53+
54 def format_for_display(self):
55 """Produce a string representation of the Error.
56
57@@ -84,6 +88,9 @@
58 def get_blueprint_name(self):
59 return self.blueprint.name
60
61+ def get_project_name(self):
62+ return self.blueprint.url.split('/')[-3]
63+
64
65 class BlueprintURLError(Error):
66 """A deprecated class for backwards-compatibility.
67@@ -101,6 +108,9 @@
68 def get_blueprint_name(self):
69 return self.blueprint_url.split('/')[-1]
70
71+ def get_project_name(self):
72+ return self.blueprint_url.split('/')[-3]
73+
74
75 class MilestoneError(Error):
76

Subscribers

People subscribed via source and target branches