launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01792
[Merge] lp:~stub/launchpad/trivial into lp:launchpad/devel
Stuart Bishop has proposed merging lp:~stub/launchpad/trivial into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#654639 Python 2.5 compatibility code to remove
https://bugs.launchpad.net/bugs/654639
#667883 database performance report: fold edge into lpnet
https://bugs.launchpad.net/bugs/667883
Remove some Python 2.5 compatibility code.
Fold edge database stats into lpnet database stats, per Bug #667883
--
https://code.launchpad.net/~stub/launchpad/trivial/+merge/39935
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/trivial into lp:launchpad/devel.
=== modified file 'lib/lp/services/scripts/base.py'
--- lib/lp/services/scripts/base.py 2010-10-07 16:51:23 +0000
+++ lib/lp/services/scripts/base.py 2010-11-03 07:56:14 +0000
@@ -393,13 +393,10 @@
def cronscript_enabled(control_url, name, log):
"""Return True if the cronscript is enabled."""
try:
- if sys.version_info[:2] >= (2, 6):
- # Timeout of 5 seconds should be fine on the LAN. We don't want
- # the default as it is too long for scripts being run every 60
- # seconds.
- control_fp = urlopen(control_url, timeout=5)
- else:
- control_fp = urlopen(control_url)
+ # Timeout of 5 seconds should be fine on the LAN. We don't want
+ # the default as it is too long for scripts being run every 60
+ # seconds.
+ control_fp = urlopen(control_url, timeout=5)
# Yuck. API makes it hard to catch 'does not exist'.
except HTTPError, error:
if error.code == 404:
=== modified file 'utilities/report-database-stats.py'
--- utilities/report-database-stats.py 2010-06-29 10:35:44 +0000
+++ utilities/report-database-stats.py 2010-11-03 07:56:14 +0000
@@ -132,7 +132,24 @@
GROUP BY username
""" % params)
cur.execute(query)
- return set(cur.fetchall())
+ cpu_stats = set(cur.fetchall())
+
+ # Fold edge into lpnet, as they are now running the same code.
+ # This is a temporary hack until we drop edge entirely. See
+ # Bug #667883 for details.
+ lpnet_avg_cpu = 0.0
+ edge_avg_cpu = 0.0
+ for stats_tuple in list(cpu_stats):
+ avg_cpu, username = stats_tuple
+ if username == 'lpnet':
+ lpnet_avg_cpu = avg_cpu
+ cpu_stats.discard(stats_tuple)
+ elif username == 'edge':
+ edge_avg_cpu = avg_cpu
+ cpu_stats.discard(stats_tuple)
+ cpu_stats.add((lpnet_avg_cpu + edge_avg_cpu, 'lpnet'))
+
+ return cpu_stats
def main():