launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #09151
Notifying owners/assignees of BPs whose work items cannot be migrated
Hi folks,
We've just deployed the new work items UI and migrated the work items of
all Linaro blueprints. As we expected, though, not all of them could be
migrated (~10% of them failed to parse), so we emailed the
owners/assignees of those Blueprints asking them to do so manually. The
script.txt file attached here has all the steps necessary to do so, for
when the time comes to do the migration of Ubuntu blueprints.
Hope it helps.
--
Guilherme Salgado <https://launchpad.net/~salgado>
1. Get the logs /srv/launchpad.net-logs/scripts/ackee/garbo-frequently.log
2. Every time the garbo runs it will try to parse all BPs that have the 'work
items' string in their whiteboard, so you need to save only the logs of the
last run into a separate file (failed-to-migrate.txt)
3. Extract the IDs of the Specifications we failed to migrate:
$ grep -o "<Specification [0-9]*" failed-to-migrate.txt | cut -f 2 -d " "
4. Use those IDs on the query below
5. Ask webops to run it on production (including the pset commands)
6. Ask them to send you the output.csv file
7. Place output.csv on the same directory as parse_bps_to_notify.py
8. Run parse_bps_to_notify.py
9. Run spam.py (from lp-dev-utils) passing the final.csv file and the file
named 'template'
\pset format unaligned
\pset fieldsep ,
\pset tuples_only on
\o output.csv
SELECT specification.name, product.name, distribution.name, e1.email as assignee_email,
p1.displayname as assignee_name,
e2.email as owner_email, p2.displayname as owner_name
FROM specification
JOIN person p1 on p1.id = assignee
JOIN emailaddress e1 on e1.person = assignee
JOIN person p2 on p2.id = owner
JOIN emailaddress e2 on e2.person = owner
LEFT JOIN product on product.id = specification.product
LEFT JOIN distribution on distribution.id = specification.distribution
WHERE e1.status = 4 and e2.status = 4
and specification.datecreated > '2011-08-01'
and specification.id in (
$SPEC_IDS
);
import csv
fieldnames = ['name', 'product', 'distribution', 'assignee_email',
'assignee_name', 'owner_email', 'owner_name']
reader = csv.DictReader(open('output.csv'), fieldnames)
bps_to_people = {}
def make_url(item):
pillar = item['product'] or item['distribution']
return 'https://blueprints.launchpad.net/%s/+spec/%s' % (
pillar, item['name'])
for item in reader:
url = make_url(item)
assignee = (item['assignee_email'], item['assignee_name'])
owner = (item['owner_email'], item['owner_name'])
if assignee not in bps_to_people:
bps_to_people[assignee] = set()
if owner not in bps_to_people:
bps_to_people[owner] = set()
bps_to_people[assignee].add(url)
if owner != assignee:
bps_to_people[owner].add(url)
fieldnames = ['display_name', 'email', 'urls']
writer = csv.DictWriter(open('final.csv', 'w'), fieldnames)
writer.writeheader()
for key, value in bps_to_people.items():
email, display_name = key
urls = "\n ".join(value)
urls = " " + urls
writer.writerow(dict(email=email, display_name=display_name, urls=urls))
Hello $display_name,
News about one or more of your blueprints
------------------------------------------
Launchpad now supports blueprint work items natively! See the
Launchpad blog [1] for details.
You have one or more blueprints that appeared to have work items in
the whiteboard. When our script tried to convert those to native work
items, there was a problem.
If those blueprints are still relevant, please check them and manually
move the work items from the whiteboard to the new work items text
box.
The blueprints we had a problem with were:
$urls
If you have any questions, please join us in #launchpad on Freenode or
reply to this email.
Thanks,
The Launchpad team.
1. http://blog.launchpad.net
Attachment:
signature.asc
Description: OpenPGP digital signature