Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: gm/rebaseline_server/server.py

Issue 232103002: rebaseline_server: allow user to specify which builders to process (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: expose to command line Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 210
211 class Server(object): 211 class Server(object):
212 """ HTTP server for our HTML rebaseline viewer. """ 212 """ HTTP server for our HTML rebaseline viewer. """
213 213
214 def __init__(self, 214 def __init__(self,
215 actuals_dir=DEFAULT_ACTUALS_DIR, 215 actuals_dir=DEFAULT_ACTUALS_DIR,
216 actuals_repo_revision=DEFAULT_ACTUALS_REPO_REVISION, 216 actuals_repo_revision=DEFAULT_ACTUALS_REPO_REVISION,
217 actuals_repo_url=DEFAULT_ACTUALS_REPO_URL, 217 actuals_repo_url=DEFAULT_ACTUALS_REPO_URL,
218 port=DEFAULT_PORT, export=False, editable=True, 218 port=DEFAULT_PORT, export=False, editable=True,
219 reload_seconds=0, config_pairs=None): 219 reload_seconds=0, config_pairs=None, builder_regex_list=None):
220 """ 220 """
221 Args: 221 Args:
222 actuals_dir: directory under which we will check out the latest actual 222 actuals_dir: directory under which we will check out the latest actual
223 GM results 223 GM results
224 actuals_repo_revision: revision of actual-results.json files to process 224 actuals_repo_revision: revision of actual-results.json files to process
225 actuals_repo_url: SVN repo to download actual-results.json files from; 225 actuals_repo_url: SVN repo to download actual-results.json files from;
226 if None or '', don't fetch new actual-results files at all, 226 if None or '', don't fetch new actual-results files at all,
227 just compare to whatever files are already in actuals_dir 227 just compare to whatever files are already in actuals_dir
228 port: which TCP port to listen on for HTTP requests 228 port: which TCP port to listen on for HTTP requests
229 export: whether to allow HTTP clients on other hosts to access this server 229 export: whether to allow HTTP clients on other hosts to access this server
230 editable: whether HTTP clients are allowed to submit new baselines 230 editable: whether HTTP clients are allowed to submit new baselines
231 reload_seconds: polling interval with which to check for new results; 231 reload_seconds: polling interval with which to check for new results;
232 if 0, don't check for new results at all 232 if 0, don't check for new results at all
233 config_pairs: List of (string, string) tuples; for each tuple, compare 233 config_pairs: List of (string, string) tuples; for each tuple, compare
234 actual results of these two configs. If None or empty, 234 actual results of these two configs. If None or empty,
235 don't compare configs at all. 235 don't compare configs at all.
236 builder_regex_list: List of regular expressions specifying which builders
237 we will process. If None, process all builders.
236 """ 238 """
237 self._actuals_dir = actuals_dir 239 self._actuals_dir = actuals_dir
238 self._actuals_repo_revision = actuals_repo_revision 240 self._actuals_repo_revision = actuals_repo_revision
239 self._actuals_repo_url = actuals_repo_url 241 self._actuals_repo_url = actuals_repo_url
240 self._port = port 242 self._port = port
241 self._export = export 243 self._export = export
242 self._editable = editable 244 self._editable = editable
243 self._reload_seconds = reload_seconds 245 self._reload_seconds = reload_seconds
244 self._config_pairs = config_pairs or [] 246 self._config_pairs = config_pairs or []
247 self._builder_regex_list = builder_regex_list
245 _create_index( 248 _create_index(
246 file_path=os.path.join( 249 file_path=os.path.join(
247 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_HTML_SUBDIR, 250 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_HTML_SUBDIR,
248 "index.html"), 251 "index.html"),
249 config_pairs=config_pairs) 252 config_pairs=config_pairs)
250 if actuals_repo_url: 253 if actuals_repo_url:
251 self._actuals_repo = _create_svn_checkout( 254 self._actuals_repo = _create_svn_checkout(
252 dir_path=actuals_dir, repo_url=actuals_repo_url) 255 dir_path=actuals_dir, repo_url=actuals_repo_url)
253 256
254 # Reentrant lock that must be held whenever updating EITHER of: 257 # Reentrant lock that must be held whenever updating EITHER of:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 'Updating expected GM results in %s by syncing Skia repo ...' % 325 'Updating expected GM results in %s by syncing Skia repo ...' %
323 compare_to_expectations.DEFAULT_EXPECTATIONS_DIR) 326 compare_to_expectations.DEFAULT_EXPECTATIONS_DIR)
324 _run_command(['gclient', 'sync'], TRUNK_DIRECTORY) 327 _run_command(['gclient', 'sync'], TRUNK_DIRECTORY)
325 328
326 self._results = compare_to_expectations.ExpectationComparisons( 329 self._results = compare_to_expectations.ExpectationComparisons(
327 actuals_root=self._actuals_dir, 330 actuals_root=self._actuals_dir,
328 generated_images_root=os.path.join( 331 generated_images_root=os.path.join(
329 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, 332 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR,
330 GENERATED_IMAGES_SUBDIR), 333 GENERATED_IMAGES_SUBDIR),
331 diff_base_url=posixpath.join( 334 diff_base_url=posixpath.join(
332 os.pardir, STATIC_CONTENTS_SUBDIR, GENERATED_IMAGES_SUBDIR)) 335 os.pardir, STATIC_CONTENTS_SUBDIR, GENERATED_IMAGES_SUBDIR),
336 builder_regex_list=self._builder_regex_list)
333 337
334 json_dir = os.path.join( 338 json_dir = os.path.join(
335 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_JSON_SUBDIR) 339 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, GENERATED_JSON_SUBDIR)
336 if not os.path.isdir(json_dir): 340 if not os.path.isdir(json_dir):
337 os.makedirs(json_dir) 341 os.makedirs(json_dir)
338 342
339 for config_pair in self._config_pairs: 343 for config_pair in self._config_pairs:
340 config_comparisons = compare_configs.ConfigComparisons( 344 config_comparisons = compare_configs.ConfigComparisons(
341 configs=config_pair, 345 configs=config_pair,
342 actuals_root=self._actuals_dir, 346 actuals_root=self._actuals_dir,
343 generated_images_root=os.path.join( 347 generated_images_root=os.path.join(
344 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR, 348 PARENT_DIRECTORY, STATIC_CONTENTS_SUBDIR,
345 GENERATED_IMAGES_SUBDIR), 349 GENERATED_IMAGES_SUBDIR),
346 diff_base_url=posixpath.join( 350 diff_base_url=posixpath.join(
347 os.pardir, GENERATED_IMAGES_SUBDIR)) 351 os.pardir, GENERATED_IMAGES_SUBDIR),
352 builder_regex_list=self._builder_regex_list)
348 for summary_type in SUMMARY_TYPES: 353 for summary_type in SUMMARY_TYPES:
349 gm_json.WriteToFile( 354 gm_json.WriteToFile(
350 config_comparisons.get_packaged_results_of_type( 355 config_comparisons.get_packaged_results_of_type(
351 results_type=summary_type), 356 results_type=summary_type),
352 os.path.join( 357 os.path.join(
353 json_dir, '%s-vs-%s_%s.json' % ( 358 json_dir, '%s-vs-%s_%s.json' % (
354 config_pair[0], config_pair[1], summary_type))) 359 config_pair[0], config_pair[1], summary_type)))
355 360
356 def _result_loader(self, reload_seconds=0): 361 def _result_loader(self, reload_seconds=0):
357 """ Call self.update_results(), either once or periodically. 362 """ Call self.update_results(), either once or periodically.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 'files from. Defaults to %(default)s ; if set to ' 625 'files from. Defaults to %(default)s ; if set to '
621 'empty string, just compare to actual-results ' 626 'empty string, just compare to actual-results '
622 'already found in ACTUALS_DIR.'), 627 'already found in ACTUALS_DIR.'),
623 default=DEFAULT_ACTUALS_REPO_URL) 628 default=DEFAULT_ACTUALS_REPO_URL)
624 parser.add_argument('--actuals-revision', 629 parser.add_argument('--actuals-revision',
625 help=('revision of actual-results.json files to process. ' 630 help=('revision of actual-results.json files to process. '
626 'Defaults to %(default)s . Beware of setting this ' 631 'Defaults to %(default)s . Beware of setting this '
627 'argument in conjunction with --editable; you ' 632 'argument in conjunction with --editable; you '
628 'probably only want to edit results at HEAD.'), 633 'probably only want to edit results at HEAD.'),
629 default=DEFAULT_ACTUALS_REPO_REVISION) 634 default=DEFAULT_ACTUALS_REPO_REVISION)
635 parser.add_argument('--builders', metavar='BUILDER_REGEX', nargs='+',
636 help=('Only process builders matching these regular '
637 'expressions. If unspecified, process all '
638 'builders.'))
630 parser.add_argument('--compare-configs', action='store_true', 639 parser.add_argument('--compare-configs', action='store_true',
631 help=('In addition to generating differences between ' 640 help=('In addition to generating differences between '
632 'expectations and actuals, also generate ' 641 'expectations and actuals, also generate '
633 'differences between these config pairs: ' 642 'differences between these config pairs: '
634 + str(CONFIG_PAIRS_TO_COMPARE))) 643 + str(CONFIG_PAIRS_TO_COMPARE)))
635 parser.add_argument('--editable', action='store_true', 644 parser.add_argument('--editable', action='store_true',
636 help=('Allow HTTP clients to submit new baselines.')) 645 help=('Allow HTTP clients to submit new baselines.'))
637 parser.add_argument('--export', action='store_true', 646 parser.add_argument('--export', action='store_true',
638 help=('Instead of only allowing access from HTTP clients ' 647 help=('Instead of only allowing access from HTTP clients '
639 'on localhost, allow HTTP clients on other hosts ' 648 'on localhost, allow HTTP clients on other hosts '
(...skipping 16 matching lines...) Expand all
656 if args.compare_configs: 665 if args.compare_configs:
657 config_pairs = CONFIG_PAIRS_TO_COMPARE 666 config_pairs = CONFIG_PAIRS_TO_COMPARE
658 else: 667 else:
659 config_pairs = None 668 config_pairs = None
660 669
661 global _SERVER 670 global _SERVER
662 _SERVER = Server(actuals_dir=args.actuals_dir, 671 _SERVER = Server(actuals_dir=args.actuals_dir,
663 actuals_repo_revision=args.actuals_revision, 672 actuals_repo_revision=args.actuals_revision,
664 actuals_repo_url=args.actuals_repo, 673 actuals_repo_url=args.actuals_repo,
665 port=args.port, export=args.export, editable=args.editable, 674 port=args.port, export=args.export, editable=args.editable,
666 reload_seconds=args.reload, config_pairs=config_pairs) 675 reload_seconds=args.reload, config_pairs=config_pairs,
676 builder_regex_list=args.builders)
667 _SERVER.run() 677 _SERVER.run()
668 678
669 679
670 if __name__ == '__main__': 680 if __name__ == '__main__':
671 main() 681 main()
OLDNEW
« gm/rebaseline_server/compare_configs.py ('K') | « gm/rebaseline_server/results_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698