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

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

Issue 310093003: rebaseline_server: download actual-results.json files from GCS instead of SVN (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move gs_utils.py and url_utils.py into tools/pyutils Created 6 years, 6 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 2014 Google Inc. 4 Copyright 2014 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 Compare results of two render_pictures runs. 9 Compare results of two render_pictures runs.
10 """ 10 """
11 11
12 # System-level imports 12 # System-level imports
13 import logging 13 import logging
14 import os 14 import os
15 import re 15 import re
16 import sys
17 import time 16 import time
18 17
19 # Imports from within Skia 18 # Imports from within Skia
19 import import_gm
20 import import_tools
20 # 21 #
21 # TODO(epoger): Once we move the create_filepath_url() function out of 22 from pyutils import url_utils
22 # download_actuals into a shared utility module, we won't need to import
23 # download_actuals anymore.
24 #
25 # We need to add the 'gm' directory, so that we can import gm_json.py within
26 # that directory. That script allows us to parse the actual-results.json file
27 # written out by the GM tool.
28 # Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end*
29 # so any dirs that are already in the PYTHONPATH will be preferred.
30 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
31 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY)
32 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY)
33 if GM_DIRECTORY not in sys.path:
34 sys.path.append(GM_DIRECTORY)
35 import download_actuals
36 import gm_json 23 import gm_json
37 import imagediffdb 24 import imagediffdb
38 import imagepair 25 import imagepair
39 import imagepairset 26 import imagepairset
40 import results 27 import results
41 28
42 # URL under which all render_pictures images can be found in Google Storage. 29 # URL under which all render_pictures images can be found in Google Storage.
43 # TODO(epoger): Move this default value into 30 # TODO(epoger): Move this default value into
44 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j son 31 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j son
45 DEFAULT_IMAGE_BASE_URL = 'http://chromium-skia-gm.commondatastorage.googleapis.c om/render_pictures/images' 32 DEFAULT_IMAGE_BASE_URL = 'http://chromium-skia-gm.commondatastorage.googleapis.c om/render_pictures/images'
(...skipping 21 matching lines...) Expand all
67 where to download the images from 54 where to download the images from
68 diff_base_url: base URL within which the client should look for diff 55 diff_base_url: base URL within which the client should look for diff
69 images; if not specified, defaults to a "file:///" URL representation 56 images; if not specified, defaults to a "file:///" URL representation
70 of generated_images_root 57 of generated_images_root
71 """ 58 """
72 time_start = int(time.time()) 59 time_start = int(time.time())
73 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) 60 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root)
74 self._image_base_url = image_base_url 61 self._image_base_url = image_base_url
75 self._diff_base_url = ( 62 self._diff_base_url = (
76 diff_base_url or 63 diff_base_url or
77 download_actuals.create_filepath_url(generated_images_root)) 64 url_utils.create_filepath_url(generated_images_root))
78 self._load_result_pairs(actuals_root, subdirs) 65 self._load_result_pairs(actuals_root, subdirs)
79 self._timestamp = int(time.time()) 66 self._timestamp = int(time.time())
80 logging.info('Results complete; took %d seconds.' % 67 logging.info('Results complete; took %d seconds.' %
81 (self._timestamp - time_start)) 68 (self._timestamp - time_start))
82 69
83 def _load_result_pairs(self, actuals_root, subdirs): 70 def _load_result_pairs(self, actuals_root, subdirs):
84 """Loads all JSON files found within two subdirs in actuals_root, 71 """Loads all JSON files found within two subdirs in actuals_root,
85 compares across those two subdirs, and stores the summary in self._results. 72 compares across those two subdirs, and stores the summary in self._results.
86 73
87 Args: 74 Args:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 extra_columns=extra_columns_dict) 236 extra_columns=extra_columns_dict)
250 except (KeyError, TypeError): 237 except (KeyError, TypeError):
251 logging.exception( 238 logging.exception(
252 'got exception while creating ImagePair for' 239 'got exception while creating ImagePair for'
253 ' test="%s", config="%s", urlPair=("%s","%s")' % ( 240 ' test="%s", config="%s", urlPair=("%s","%s")' % (
254 test, config, imageA_relative_url, imageB_relative_url)) 241 test, config, imageA_relative_url, imageB_relative_url))
255 return None 242 return None
256 243
257 244
258 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh 245 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698