Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/stats/bin/pagegenerator.py

Issue 11481051: Update stats processing (Closed)
Left Patch Set: Fixed review issues Created Aug. 27, 2013, 7:29 a.m.
Right Patch Set: Improved performance using memoization Created Aug. 29, 2013, 1:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/stats/bin/logprocessor.py ('k') | sitescripts/stats/common.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 outputfile = os.path.join(outputdir, 134 outputfile = os.path.join(outputdir,
135 common.filename_encode(server_type), 135 common.filename_encode(server_type),
136 common.filename_encode(month), 136 common.filename_encode(month),
137 common.filename_encode(filename), 137 common.filename_encode(filename),
138 "index.html") 138 "index.html")
139 generate_file_stats(outputfile, month, baseURL + filename, overview_url, 139 generate_file_stats(outputfile, month, baseURL + filename, overview_url,
140 data, filtered_urls=filtered_urls) 140 data, filtered_urls=filtered_urls)
141 141
142 if filename not in filedata: 142 if filename not in filedata:
143 filedata[filename] = {} 143 filedata[filename] = {}
144 month_url = (common.filename_encode(month) + "/" + 144 month_url = "%s/%s/%s" % (common.filename_encode(month),
145 common.filename_encode(filename) + "/" + 145 common.filename_encode(filename),
146 "index.html") 146 "index.html")
147 filedata[filename][month] = {"url": month_url, "hits": data["hits"], "ba ndwidth": data["bandwidth"]} 147 filedata[filename][month] = {"url": month_url, "hits": data["hits"], "ba ndwidth": data["bandwidth"]}
148 148
149 monthdata = {} 149 monthdata = {}
150 for filename, data in filedata.iteritems(): 150 for filename, data in filedata.iteritems():
151 outputfile = os.path.join(outputdir, 151 outputfile = os.path.join(outputdir,
152 common.filename_encode(server_type), 152 common.filename_encode(server_type),
153 "overview-" + common.filename_encode(filename + ".html")) 153 "overview-" + common.filename_encode(filename + ".html"))
154 generate_file_overview(outputfile, baseURL + filename, data) 154 generate_file_overview(outputfile, baseURL + filename, data)
155 155
156 if current_month in data: 156 if current_month in data:
157 monthdata[filename] = dict(data[current_month]) 157 monthdata[filename] = dict(data[current_month])
158 158
159 outputfile = os.path.join(outputdir, common.filename_encode(server_type), "i ndex.html") 159 outputfile = os.path.join(outputdir, common.filename_encode(server_type), "i ndex.html")
160 generate_main_page(outputfile, current_month, baseURL, monthdata) 160 generate_main_page(outputfile, current_month, baseURL, monthdata)
161 161
162 if __name__ == '__main__': 162 if __name__ == '__main__':
163 setupStderr() 163 setupStderr()
164 164
165 datadir = get_config().get("stats", "dataDirectory") 165 datadir = get_config().get("stats", "dataDirectory")
166 outputdir = get_config().get("stats", "outputDirectory") 166 outputdir = get_config().get("stats", "outputDirectory")
167 generate_pages(datadir, outputdir) 167 generate_pages(datadir, outputdir)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld