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

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

Issue 105213007: rebaseline_server: add more timing and progress info to server-side log (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | gm/rebaseline_server/server.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
epoger 2013/12/18 18:24:12 I suppose it would be good for the client side to
3 """ 3 """
epoger 2013/12/18 18:24:12 The server-side log now looks like this: epoger@w
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 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
10 """ 10 """
11 11
12 # System-level imports 12 # System-level imports
13 import fnmatch 13 import fnmatch
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 file contents, you will need to create a new Results object.""" 57 file contents, you will need to create a new Results object."""
58 58
59 def __init__(self, actuals_root, expected_root, generated_images_root): 59 def __init__(self, actuals_root, expected_root, generated_images_root):
60 """ 60 """
61 Args: 61 Args:
62 actuals_root: root directory containing all actual-results.json files 62 actuals_root: root directory containing all actual-results.json files
63 expected_root: root directory containing all expected-results.json files 63 expected_root: root directory containing all expected-results.json files
64 generated_images_root: directory within which to create all pixel diffs; 64 generated_images_root: directory within which to create all pixel diffs;
65 if this directory does not yet exist, it will be created 65 if this directory does not yet exist, it will be created
66 """ 66 """
67 time_start = int(time.time())
67 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) 68 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root)
68 self._actuals_root = actuals_root 69 self._actuals_root = actuals_root
69 self._expected_root = expected_root 70 self._expected_root = expected_root
70 self._load_actual_and_expected() 71 self._load_actual_and_expected()
71 self._timestamp = int(time.time()) 72 self._timestamp = int(time.time())
73 logging.info('Results complete; took %d seconds.' %
74 (self._timestamp - time_start))
72 75
73 def get_timestamp(self): 76 def get_timestamp(self):
74 """Return the time at which this object was created, in seconds past epoch 77 """Return the time at which this object was created, in seconds past epoch
75 (UTC). 78 (UTC).
76 """ 79 """
77 return self._timestamp 80 return self._timestamp
78 81
79 def edit_expectations(self, modifications): 82 def edit_expectations(self, modifications):
80 """Edit the expectations stored within this object and write them back 83 """Edit the expectations stored within this object and write them back
81 to disk. 84 to disk.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 expected_image_locator=expected_hashdigest, 284 expected_image_locator=expected_hashdigest,
282 expected_image_url=expected_url, 285 expected_image_url=expected_url,
283 actual_image_locator=actual_hashdigest, 286 actual_image_locator=actual_hashdigest,
284 actual_image_url=actual_url) 287 actual_image_url=actual_url)
285 288
286 def _load_actual_and_expected(self): 289 def _load_actual_and_expected(self):
287 """Loads the results of all tests, across all builders (based on the 290 """Loads the results of all tests, across all builders (based on the
288 files within self._actuals_root and self._expected_root), 291 files within self._actuals_root and self._expected_root),
289 and stores them in self._results. 292 and stores them in self._results.
290 """ 293 """
294 logging.info('Reading actual-results JSON files from %s...' %
295 self._actuals_root)
291 actual_builder_dicts = Results._read_dicts_from_root(self._actuals_root) 296 actual_builder_dicts = Results._read_dicts_from_root(self._actuals_root)
297 logging.info('Reading expected-results JSON files from %s...' %
298 self._expected_root)
292 expected_builder_dicts = Results._read_dicts_from_root(self._expected_root) 299 expected_builder_dicts = Results._read_dicts_from_root(self._expected_root)
293 300
294 categories_all = {} 301 categories_all = {}
295 categories_failures = {} 302 categories_failures = {}
296 303
297 Results._ensure_included_in_category_dict(categories_all, 304 Results._ensure_included_in_category_dict(categories_all,
298 'resultType', [ 305 'resultType', [
299 gm_json.JSONKEY_ACTUALRESULTS_FAILED, 306 gm_json.JSONKEY_ACTUALRESULTS_FAILED,
300 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED, 307 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED,
301 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON, 308 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON,
302 gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED, 309 gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED,
303 ]) 310 ])
304 Results._ensure_included_in_category_dict(categories_failures, 311 Results._ensure_included_in_category_dict(categories_failures,
305 'resultType', [ 312 'resultType', [
306 gm_json.JSONKEY_ACTUALRESULTS_FAILED, 313 gm_json.JSONKEY_ACTUALRESULTS_FAILED,
307 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED, 314 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED,
308 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON, 315 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON,
309 ]) 316 ])
310 317
311 data_all = [] 318 data_all = []
312 data_failures = [] 319 data_failures = []
313 for builder in sorted(actual_builder_dicts.keys()): 320 builders = sorted(actual_builder_dicts.keys())
321 num_builders = len(builders)
322 builder_num = 0
323 for builder in builders:
324 builder_num += 1
325 logging.info('Generating pixel diffs for builder #%d of %d, "%s"...' %
326 (builder_num, num_builders, builder))
314 actual_results_for_this_builder = ( 327 actual_results_for_this_builder = (
315 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS]) 328 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS])
316 for result_type in sorted(actual_results_for_this_builder.keys()): 329 for result_type in sorted(actual_results_for_this_builder.keys()):
317 results_of_this_type = actual_results_for_this_builder[result_type] 330 results_of_this_type = actual_results_for_this_builder[result_type]
318 if not results_of_this_type: 331 if not results_of_this_type:
319 continue 332 continue
320 for image_name in sorted(results_of_this_type.keys()): 333 for image_name in sorted(results_of_this_type.keys()):
321 actual_image = results_of_this_type[image_name] 334 actual_image = results_of_this_type[image_name]
322 335
323 # Default empty expectations; overwrite these if we find any real ones 336 # Default empty expectations; overwrite these if we find any real ones
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 category_dict: category dict-of-dicts to modify 489 category_dict: category dict-of-dicts to modify
477 category_name: category name, as a string 490 category_name: category name, as a string
478 category_values: list of values we want to make sure are represented 491 category_values: list of values we want to make sure are represented
479 for this category 492 for this category
480 """ 493 """
481 if not category_dict.get(category_name): 494 if not category_dict.get(category_name):
482 category_dict[category_name] = {} 495 category_dict[category_name] = {}
483 for category_value in category_values: 496 for category_value in category_values:
484 if not category_dict[category_name].get(category_value): 497 if not category_dict[category_name].get(category_value):
485 category_dict[category_name][category_value] = 0 498 category_dict[category_name][category_value] = 0
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698