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

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

Issue 451053004: change setA/setB labels if viewing actuals vs expectations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add hover-notes to setA and setB column headers Created 6 years, 4 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
« no previous file with comments | « no previous file | gm/rebaseline_server/compare_rendered_pictures_test.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
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
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 class RenderedPicturesComparisons(results.BaseComparisons): 72 class RenderedPicturesComparisons(results.BaseComparisons):
73 """Loads results from multiple render_pictures runs into an ImagePairSet. 73 """Loads results from multiple render_pictures runs into an ImagePairSet.
74 """ 74 """
75 75
76 def __init__(self, 76 def __init__(self,
77 setA_dirs, setB_dirs, 77 setA_dirs, setB_dirs,
78 setA_section, setB_section, 78 setA_section, setB_section,
79 image_diff_db, 79 image_diff_db,
80 image_base_gs_url=DEFAULT_IMAGE_BASE_GS_URL, diff_base_url=None, 80 image_base_gs_url=DEFAULT_IMAGE_BASE_GS_URL, diff_base_url=None,
81 setA_label='setA', setB_label='setB', 81 setA_label=None, setB_label=None,
82 gs=None, truncate_results=False, prefetch_only=False, 82 gs=None, truncate_results=False, prefetch_only=False,
83 download_all_images=False): 83 download_all_images=False):
84 """Constructor: downloads images and generates diffs. 84 """Constructor: downloads images and generates diffs.
85 85
86 Once the object has been created (which may take a while), you can call its 86 Once the object has been created (which may take a while), you can call its
87 get_packaged_results_of_type() method to quickly retrieve the results... 87 get_packaged_results_of_type() method to quickly retrieve the results...
88 unless you have set prefetch_only to True, in which case we will 88 unless you have set prefetch_only to True, in which case we will
89 asynchronously warm up the ImageDiffDB cache but not fill in self._results. 89 asynchronously warm up the ImageDiffDB cache but not fill in self._results.
90 90
91 Args: 91 Args:
92 setA_dirs: list of root directories to copy all JSON summaries from, 92 setA_dirs: list of root directories to copy all JSON summaries from,
93 and to use as setA within the comparisons. These directories may be 93 and to use as setA within the comparisons. These directories may be
94 gs:// URLs, special "repo:" URLs, or local filepaths. 94 gs:// URLs, special "repo:" URLs, or local filepaths.
95 setB_dirs: list of root directories to copy all JSON summaries from, 95 setB_dirs: list of root directories to copy all JSON summaries from,
96 and to use as setB within the comparisons. These directories may be 96 and to use as setB within the comparisons. These directories may be
97 gs:// URLs, special "repo:" URLs, or local filepaths. 97 gs:// URLs, special "repo:" URLs, or local filepaths.
98 setA_section: which section within setA to examine; must be one of 98 setA_section: which section within setA to examine; must be one of
99 ALLOWED_SECTION_NAMES 99 ALLOWED_SECTION_NAMES
100 setB_section: which section within setB to examine; must be one of 100 setB_section: which section within setB to examine; must be one of
101 ALLOWED_SECTION_NAMES 101 ALLOWED_SECTION_NAMES
102 image_diff_db: ImageDiffDB instance 102 image_diff_db: ImageDiffDB instance
103 image_base_gs_url: "gs://" URL pointing at the Google Storage bucket/dir 103 image_base_gs_url: "gs://" URL pointing at the Google Storage bucket/dir
104 under which all render_pictures result images can 104 under which all render_pictures result images can
105 be found; this will be used to read images for comparison within 105 be found; this will be used to read images for comparison within
106 this code, and included in the ImagePairSet (as an HTTP URL) so its 106 this code, and included in the ImagePairSet (as an HTTP URL) so its
107 consumers know where to download the images from 107 consumers know where to download the images from
108 diff_base_url: base URL within which the client should look for diff 108 diff_base_url: base URL within which the client should look for diff
109 images; if not specified, defaults to a "file:///" URL representation 109 images; if not specified, defaults to a "file:///" URL representation
110 of image_diff_db's storage_root 110 of image_diff_db's storage_root
111 setA_label: description to use for results in setA 111 setA_label: description to use for results in setA; if None, will be
112 setB_label: description to use for results in setB 112 set to a reasonable default
113 setB_label: description to use for results in setB; if None, will be
114 set to a reasonable default
113 gs: instance of GSUtils object we can use to download summary files 115 gs: instance of GSUtils object we can use to download summary files
114 truncate_results: FOR MANUAL TESTING: if True, truncate the set of images 116 truncate_results: FOR MANUAL TESTING: if True, truncate the set of images
115 we process, to speed up testing. 117 we process, to speed up testing.
116 prefetch_only: if True, return the new object as quickly as possible 118 prefetch_only: if True, return the new object as quickly as possible
117 with empty self._results (just queue up all the files to process, 119 with empty self._results (just queue up all the files to process,
118 don't wait around for them to be processed and recorded); otherwise, 120 don't wait around for them to be processed and recorded); otherwise,
119 block until the results have been assembled and recorded in 121 block until the results have been assembled and recorded in
120 self._results. 122 self._results.
121 download_all_images: if True, download all images, even if we don't 123 download_all_images: if True, download all images, even if we don't
122 need them to generate diffs. This will take much longer to complete, 124 need them to generate diffs. This will take much longer to complete,
123 but is useful for warming up the bitmap cache on local disk. 125 but is useful for warming up the bitmap cache on local disk.
124 """ 126 """
125 super(RenderedPicturesComparisons, self).__init__() 127 super(RenderedPicturesComparisons, self).__init__()
126 self._image_diff_db = image_diff_db 128 self._image_diff_db = image_diff_db
127 self._image_base_gs_url = image_base_gs_url 129 self._image_base_gs_url = image_base_gs_url
128 self._diff_base_url = ( 130 self._diff_base_url = (
129 diff_base_url or 131 diff_base_url or
130 url_utils.create_filepath_url(image_diff_db.storage_root)) 132 url_utils.create_filepath_url(image_diff_db.storage_root))
131 self._setA_label = setA_label
132 self._setB_label = setB_label
133 self._gs = gs 133 self._gs = gs
134 self.truncate_results = truncate_results 134 self.truncate_results = truncate_results
135 self._prefetch_only = prefetch_only 135 self._prefetch_only = prefetch_only
136 self._download_all_images = download_all_images 136 self._download_all_images = download_all_images
137 137
138 # If we are comparing two different section types, we can use those
139 # as the default labels for setA and setB.
140 if setA_section != setB_section:
141 self._setA_label = setA_label or setA_section
142 self._setB_label = setB_label or setB_section
143 else:
144 self._setA_label = setA_label or 'setA'
145 self._setB_label = setB_label or 'setB'
146
138 tempdir = tempfile.mkdtemp() 147 tempdir = tempfile.mkdtemp()
139 try: 148 try:
140 setA_root = os.path.join(tempdir, 'setA') 149 setA_root = os.path.join(tempdir, 'setA')
141 setB_root = os.path.join(tempdir, 'setB') 150 setB_root = os.path.join(tempdir, 'setB')
142 for source_dir in setA_dirs: 151 for source_dir in setA_dirs:
143 self._copy_dir_contents(source_dir=source_dir, dest_dir=setA_root) 152 self._copy_dir_contents(source_dir=source_dir, dest_dir=setA_root)
144 for source_dir in setB_dirs: 153 for source_dir in setB_dirs:
145 self._copy_dir_contents(source_dir=source_dir, dest_dir=setB_root) 154 self._copy_dir_contents(source_dir=source_dir, dest_dir=setB_root)
146 155
147 time_start = int(time.time()) 156 time_start = int(time.time())
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 """ 387 """
379 if gs_utils.GSUtils.is_gs_url(source_dir): 388 if gs_utils.GSUtils.is_gs_url(source_dir):
380 (bucket, path) = gs_utils.GSUtils.split_gs_url(source_dir) 389 (bucket, path) = gs_utils.GSUtils.split_gs_url(source_dir)
381 self._gs.download_dir_contents(source_bucket=bucket, source_dir=path, 390 self._gs.download_dir_contents(source_bucket=bucket, source_dir=path,
382 dest_dir=dest_dir) 391 dest_dir=dest_dir)
383 elif source_dir.lower().startswith(REPO_URL_PREFIX): 392 elif source_dir.lower().startswith(REPO_URL_PREFIX):
384 repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):]) 393 repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):])
385 shutil.copytree(repo_dir, dest_dir) 394 shutil.copytree(repo_dir, dest_dir)
386 else: 395 else:
387 shutil.copytree(source_dir, dest_dir) 396 shutil.copytree(source_dir, dest_dir)
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/compare_rendered_pictures_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698