Merge lp:~jcsackett/charmworld/fix-enqueue-sort-failure into lp:charmworld

Proposed by j.c.sackett
Status: Merged
Approved by: j.c.sackett
Approved revision: 481
Merged at revision: 480
Proposed branch: lp:~jcsackett/charmworld/fix-enqueue-sort-failure
Merge into: lp:charmworld
Diff against target: 34 lines (+2/-4)
2 files modified
charmworld/jobs/lp.py (+1/-3)
charmworld/jobs/tests/test_lp.py (+1/-1)
To merge this branch: bzr merge lp:~jcsackett/charmworld/fix-enqueue-sort-failure
Reviewer Review Type Date Requested Status
Juju Gui Bot continuous-integration Approve
j.c.sackett (community) Approve
Brad Crittenden (community) code Approve
Review via email: mp+202678@code.launchpad.net

Commit message

Fixes an enqueue error for ingest that occurs because of a non-indexed sort.

Description of the change

This branch removes the sorting on db_charms, which we don't need because we
throw the results into a dict immediately.

The sort causes mongo to explode because the data is too large to sort without
an index.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Looks good Jon.

review: Approve (code)
Revision history for this message
Juju Gui Bot (juju-gui-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://162.213.35.27:8080/job/charmworld-autoland-lxc/105/
Executed test runs:

review: Needs Fixing (continuous-integration)
Revision history for this message
j.c.sackett (jcsackett) wrote :

This may be spurious; resubmitting.

review: Approve
Revision history for this message
Juju Gui Bot (juju-gui-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://162.213.35.27:8080/job/charmworld-autoland-lxc/106/
Executed test runs:

review: Needs Fixing (continuous-integration)
481. By j.c.sackett

Shut up, lint.

Revision history for this message
Juju Gui Bot (juju-gui-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmworld/jobs/lp.py'
2--- charmworld/jobs/lp.py 2014-01-16 14:57:47 +0000
3+++ charmworld/jobs/lp.py 2014-01-22 15:27:53 +0000
4@@ -7,7 +7,6 @@
5 datetime,
6 )
7 import logging
8-import pymongo
9 import sys
10
11 from charmworld.charmstore import (
12@@ -82,8 +81,7 @@
13 # Return data needed for the ingest job for charms stored in
14 # charmworld's database.
15 for charm in db.charms.find(
16- fields=('owner', 'series', 'name', 'bname', 'branch_spec'),
17- sort=[('branch_spec', pymongo.ASCENDING)]):
18+ fields=('owner', 'series', 'name', 'bname', 'branch_spec')):
19 # Override the promulgation related settings: Data from this iterator
20 # is used by all_charms() only when the charm no longer has a related
21 # Launchpad branch. A charm is promulgated if its LP branch is linked
22
23=== modified file 'charmworld/jobs/tests/test_lp.py'
24--- charmworld/jobs/tests/test_lp.py 2014-01-16 14:57:47 +0000
25+++ charmworld/jobs/tests/test_lp.py 2014-01-22 15:27:53 +0000
26@@ -179,7 +179,7 @@
27 self.db, owner='o1', series='s1', name='c2')[1]
28 charm_4 = factory.makeCharm(
29 self.db, owner='o1', series='s1', name='c1')[1]
30- result = [c['branch_spec'] for c in db_charms(self.db)]
31+ result = sorted([c['branch_spec'] for c in db_charms(self.db)])
32 expected = [
33 c['branch_spec'] for c in (charm_4, charm_3, charm_2, charm_1)]
34 self.assertEqual(expected, result)

Subscribers

People subscribed via source and target branches

to all changes: