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

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: combine import_gm and import_tools into fix_pythonpath 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
20 # 19 import fix_pythonpath # must do this first
21 # TODO(epoger): Once we move the create_filepath_url() function out of 20 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 21 import gm_json
37 import imagediffdb 22 import imagediffdb
38 import imagepair 23 import imagepair
39 import imagepairset 24 import imagepairset
40 import results 25 import results
41 26
42 # URL under which all render_pictures images can be found in Google Storage. 27 # URL under which all render_pictures images can be found in Google Storage.
43 # TODO(epoger): Move this default value into 28 # TODO(epoger): Move this default value into
44 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j son 29 # 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' 30 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 52 where to download the images from
68 diff_base_url: base URL within which the client should look for diff 53 diff_base_url: base URL within which the client should look for diff
69 images; if not specified, defaults to a "file:///" URL representation 54 images; if not specified, defaults to a "file:///" URL representation
70 of generated_images_root 55 of generated_images_root
71 """ 56 """
72 time_start = int(time.time()) 57 time_start = int(time.time())
73 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) 58 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root)
74 self._image_base_url = image_base_url 59 self._image_base_url = image_base_url
75 self._diff_base_url = ( 60 self._diff_base_url = (
76 diff_base_url or 61 diff_base_url or
77 download_actuals.create_filepath_url(generated_images_root)) 62 url_utils.create_filepath_url(generated_images_root))
78 self._load_result_pairs(actuals_root, subdirs) 63 self._load_result_pairs(actuals_root, subdirs)
79 self._timestamp = int(time.time()) 64 self._timestamp = int(time.time())
80 logging.info('Results complete; took %d seconds.' % 65 logging.info('Results complete; took %d seconds.' %
81 (self._timestamp - time_start)) 66 (self._timestamp - time_start))
82 67
83 def _load_result_pairs(self, actuals_root, subdirs): 68 def _load_result_pairs(self, actuals_root, subdirs):
84 """Loads all JSON files found within two subdirs in actuals_root, 69 """Loads all JSON files found within two subdirs in actuals_root,
85 compares across those two subdirs, and stores the summary in self._results. 70 compares across those two subdirs, and stores the summary in self._results.
86 71
87 Args: 72 Args:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 extra_columns=extra_columns_dict) 234 extra_columns=extra_columns_dict)
250 except (KeyError, TypeError): 235 except (KeyError, TypeError):
251 logging.exception( 236 logging.exception(
252 'got exception while creating ImagePair for' 237 'got exception while creating ImagePair for'
253 ' test="%s", config="%s", urlPair=("%s","%s")' % ( 238 ' test="%s", config="%s", urlPair=("%s","%s")' % (
254 test, config, imageA_relative_url, imageB_relative_url)) 239 test, config, imageA_relative_url, imageB_relative_url))
255 return None 240 return None
256 241
257 242
258 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh 243 # 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