| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
| 5 | 5 |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 HTTP server for our HTML rebaseline viewer. | 9 HTTP server for our HTML rebaseline viewer. |
| 10 """ | 10 """ |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 """ | 215 """ |
| 216 self._actuals_dir = actuals_dir | 216 self._actuals_dir = actuals_dir |
| 217 self._json_filename = json_filename | 217 self._json_filename = json_filename |
| 218 self._gm_summaries_bucket = gm_summaries_bucket | 218 self._gm_summaries_bucket = gm_summaries_bucket |
| 219 self._port = port | 219 self._port = port |
| 220 self._export = export | 220 self._export = export |
| 221 self._editable = editable | 221 self._editable = editable |
| 222 self._reload_seconds = reload_seconds | 222 self._reload_seconds = reload_seconds |
| 223 self._config_pairs = config_pairs or [] | 223 self._config_pairs = config_pairs or [] |
| 224 self._builder_regex_list = builder_regex_list | 224 self._builder_regex_list = builder_regex_list |
| 225 self._gs = gs_utils.GSUtils() |
| 225 _create_index( | 226 _create_index( |
| 226 file_path=os.path.join( | 227 file_path=os.path.join( |
| 227 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_HTML_SUBDIR, | 228 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_HTML_SUBDIR, |
| 228 "index.html"), | 229 "index.html"), |
| 229 config_pairs=config_pairs) | 230 config_pairs=config_pairs) |
| 230 | 231 |
| 231 # Reentrant lock that must be held whenever updating EITHER of: | 232 # Reentrant lock that must be held whenever updating EITHER of: |
| 232 # 1. self._results | 233 # 1. self._results |
| 233 # 2. the expected or actual results on local disk | 234 # 2. the expected or actual results on local disk |
| 234 self.results_rlock = threading.RLock() | 235 self.results_rlock = threading.RLock() |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 matching_builders.append(builder) | 298 matching_builders.append(builder) |
| 298 break # go on to the next builder, no need to try more regexes | 299 break # go on to the next builder, no need to try more regexes |
| 299 else: | 300 else: |
| 300 matching_builders = all_builders | 301 matching_builders = all_builders |
| 301 | 302 |
| 302 # Download the JSON file for each builder we care about. | 303 # Download the JSON file for each builder we care about. |
| 303 # | 304 # |
| 304 # TODO(epoger): When this is a large number of builders, we would be | 305 # TODO(epoger): When this is a large number of builders, we would be |
| 305 # better off downloading them in parallel! | 306 # better off downloading them in parallel! |
| 306 for builder in matching_builders: | 307 for builder in matching_builders: |
| 307 gs_utils.download_file( | 308 self._gs.download_file( |
| 308 source_bucket=self._gm_summaries_bucket, | 309 source_bucket=self._gm_summaries_bucket, |
| 309 source_path=posixpath.join(builder, self._json_filename), | 310 source_path=posixpath.join(builder, self._json_filename), |
| 310 dest_path=os.path.join(self._actuals_dir, builder, | 311 dest_path=os.path.join(self._actuals_dir, builder, |
| 311 self._json_filename), | 312 self._json_filename), |
| 312 create_subdirs_if_needed=True) | 313 create_subdirs_if_needed=True) |
| 313 | 314 |
| 314 # We only update the expectations dir if the server was run with a | 315 # We only update the expectations dir if the server was run with a |
| 315 # nonzero --reload argument; otherwise, we expect the user to maintain | 316 # nonzero --reload argument; otherwise, we expect the user to maintain |
| 316 # her own expectations as she sees fit. | 317 # her own expectations as she sees fit. |
| 317 # | 318 # |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 json_filename=args.json_filename, | 699 json_filename=args.json_filename, |
| 699 gm_summaries_bucket=args.gm_summaries_bucket, | 700 gm_summaries_bucket=args.gm_summaries_bucket, |
| 700 port=args.port, export=args.export, editable=args.editable, | 701 port=args.port, export=args.export, editable=args.editable, |
| 701 reload_seconds=args.reload, config_pairs=config_pairs, | 702 reload_seconds=args.reload, config_pairs=config_pairs, |
| 702 builder_regex_list=args.builders) | 703 builder_regex_list=args.builders) |
| 703 _SERVER.run() | 704 _SERVER.run() |
| 704 | 705 |
| 705 | 706 |
| 706 if __name__ == '__main__': | 707 if __name__ == '__main__': |
| 707 main() | 708 main() |
| OLD | NEW |