← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/lp-dev-utils/ppr into lp:lp-dev-utils

 

Robert Collins has proposed merging lp:~lifeless/lp-dev-utils/ppr into lp:lp-dev-utils.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lifeless/lp-dev-utils/ppr/+merge/124084

More improvements to the PPR to let it run unaltered for e.g. ISD.
-- 
https://code.launchpad.net/~lifeless/lp-dev-utils/ppr/+merge/124084
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/lp-dev-utils/ppr into lp:lp-dev-utils.
=== modified file 'page-performance-report-daily.sh'
--- page-performance-report-daily.sh	2012-09-11 10:12:03 +0000
+++ page-performance-report-daily.sh	2012-09-13 00:46:22 +0000
@@ -10,6 +10,7 @@
 LOGS_ROOTS=${LOGS_ROOTS:-"/srv/launchpad.net-logs/production /srv/launchpad.net-logs/edge"}
 LOG_PATTERN=${LOG_PATTERN:-'launchpad-trace\*'}
 OUTPUT_ROOT=${OUTPUT_ROOT:-${HOME}/public_html/ppr/lpnet}
+JQUERY_URL=${JQUERY_URL:-'../js'}
 DAY_FMT="+%Y-%m-%d"
 
 find_logs() {
@@ -72,8 +73,9 @@
 
     echo Generating report from $from until $until into $dir `date`
 
-    ./bin/py page-performance-report.py --top-urls=200 --directory=${dir} \
-        $options ${PPR_SWITCHES} $files
+    ./bin/py page-performance-report.py -c ${CONFIG_FILE} --top-urls=200 \
+    	--jquery-url=${JQUERY_URL} --directory=${dir} $options \
+	${PPR_SWITCHES} $files
 
     # Only do the linking if requested.
     if [ "$link" = "link" ]; then
@@ -94,7 +96,6 @@
     return 0
 }
 
-local link
 if [ "$3" = "-l" ]; then
     link="link"
 fi

=== modified file 'pageperformancereport.py'
--- pageperformancereport.py	2012-08-16 19:57:50 +0000
+++ pageperformancereport.py	2012-09-13 00:46:22 +0000
@@ -770,6 +770,9 @@
         default=False, action='store_true',
         help="Files are interpreted as pickled stats and are aggregated " +
         "for the report.")
+    parser.add_option(
+        "--jquery-url", dest="jquery_url",
+        default="../js", help="Path to JQuery root directory.")
 
     options, args = parser.parse_args()
 
@@ -875,7 +878,7 @@
         html_report(
             open(report_filename, 'w'), partition_times, None, None,
             histogram_resolution=options.resolution,
-            category_name='Partition')
+            category_name='Partition', jquery_url=options.jquery_url)
 
     # Category only report.
     if options.categories:
@@ -883,7 +886,8 @@
         log.info("Generating %s", report_filename)
         html_report(
             open(report_filename, 'w'), category_times, None, None,
-            histogram_resolution=options.resolution)
+            histogram_resolution=options.resolution,
+            jquery_url=options.jquery_url)
 
     # Pageid only report.
     if options.pageids:
@@ -891,7 +895,8 @@
         log.info("Generating %s", report_filename)
         html_report(
             open(report_filename, 'w'), None, pageid_times, None,
-            histogram_resolution=options.resolution)
+            histogram_resolution=options.resolution,
+            jquery_url=options.jquery_url)
 
     # Top URL only report.
     if options.top_urls:
@@ -899,7 +904,8 @@
         log.info("Generating %s", report_filename)
         html_report(
             open(report_filename, 'w'), None, None, url_times,
-            histogram_resolution=options.resolution)
+            histogram_resolution=options.resolution,
+            jquery_url=options.jquery_url)
 
     # Combined report.
     if options.categories and options.pageids:
@@ -907,7 +913,8 @@
         html_report(
             open(report_filename, 'w'),
             category_times, pageid_times, url_times, 
-            histogram_resolution=options.resolution)
+            histogram_resolution=options.resolution,
+            jquery_url=options.jquery_url)
 
     # Report of likely timeout candidates
     report_filename = _report_filename('timeout-candidates.html')
@@ -915,7 +922,8 @@
     html_report(
         open(report_filename, 'w'), None, pageid_times, None,
         options.timeout - 2, 
-        histogram_resolution=options.resolution)
+        histogram_resolution=options.resolution,
+        jquery_url=options.jquery_url)
 
     # Save the times cache for later merging.
     report_filename = _report_filename('stats.pck.bz2')
@@ -1155,7 +1163,7 @@
 def html_report(
     outf, category_times, pageid_times, url_times,
     ninetyninth_percentile_threshold=None, histogram_resolution=0.5,
-    category_name='Category'):
+    category_name='Category', jquery_url='../js'):
     """Write an html report to outf.
 
     :param outf: A file object to write the report to.
@@ -1168,6 +1176,7 @@
     :param histogram_resolution: used as the histogram bar width
     :param category_name: The name to use for category report. Defaults to
         'Category'.
+    :param jquery_url: The URL to JQUERY. e.g. http://foo.com/js.
     """
 
     print >> outf, dedent('''\
@@ -1177,16 +1186,16 @@
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
         <title>Page Performance Report %(date)s</title>
         <script language="javascript" type="text/javascript"
-            src="../js/flot/jquery.min.js"
-            ></script>
-        <script language="javascript" type="text/javascript"
-            src="../js/jquery.appear-1.1.1.min.js"
-            ></script>
-        <script language="javascript" type="text/javascript"
-            src="../js/flot/jquery.flot.min.js"
-            ></script>
-        <script language="javascript" type="text/javascript"
-            src="../js/sorttable.js"></script>
+            src="%(JQUERY_URL)s/flot/jquery.min.js"
+            ></script>
+        <script language="javascript" type="text/javascript"
+            src="%(JQUERY_URL)s/jquery.appear-1.1.1.min.js"
+            ></script>
+        <script language="javascript" type="text/javascript"
+            src="%(JQUERY_URL)s/flot/jquery.flot.min.js"
+            ></script>
+        <script language="javascript" type="text/javascript"
+            src="%(JQUERY_URL)s/sorttable.js"></script>
         <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
         <style type="text/css">
             body { font-family: 'Ubuntu', sans-serif; }
@@ -1222,7 +1231,8 @@
         <body>
         <h1>Page Performance Report</h1>
         <h3>%(date)s</h3>
-        ''' % {'date': time.ctime()})
+        ''' % {'date': time.ctime(),
+               'JQUERY_URL': jquery_url})
 
     table_header = dedent('''\
         <table class="sortable page-performance-report">