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

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

Issue 379563005: rebaseline_server: cache results in long-running ImageDiffDB instance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « gm/rebaseline_server/compare_to_expectations_test.py ('k') | 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
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 Calulate differences between image pairs, and store them in a database. 9 Calulate differences between image pairs, and store them in a database.
10 """ 10 """
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 """ 214 """
215 Args: 215 Args:
216 storage_root: string; root path within the DB will store all of its stuff 216 storage_root: string; root path within the DB will store all of its stuff
217 """ 217 """
218 self._storage_root = storage_root 218 self._storage_root = storage_root
219 219
220 # Dictionary of DiffRecords, keyed by (expected_image_locator, 220 # Dictionary of DiffRecords, keyed by (expected_image_locator,
221 # actual_image_locator) tuples. 221 # actual_image_locator) tuples.
222 self._diff_dict = {} 222 self._diff_dict = {}
223 223
224 def get_storage_root(self):
rmistry 2014/07/09 13:14:04 [Optional] Can also do: @property def storage_roo
epoger 2014/07/09 14:57:36 Good point. Fixed this one, and added a TODO for
225 return self._storage_root
226
224 def add_image_pair(self, 227 def add_image_pair(self,
225 expected_image_url, expected_image_locator, 228 expected_image_url, expected_image_locator,
226 actual_image_url, actual_image_locator): 229 actual_image_url, actual_image_locator):
227 """Download this pair of images (unless we already have them on local disk), 230 """Download this pair of images (unless we already have them on local disk),
228 and prepare a DiffRecord for them. 231 and prepare a DiffRecord for them.
229 232
230 TODO(epoger): Make this asynchronously download images, rather than blocking 233 TODO(epoger): Make this asynchronously download images, rather than blocking
231 until the images have been downloaded and processed. 234 until the images have been downloaded and processed.
232 When we do that, we should probably add a new method that will block 235 When we do that, we should probably add a new method that will block
233 until all of the images have been downloaded and processed. Otherwise, 236 until all of the images have been downloaded and processed. Otherwise,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 327
325 Args: 328 Args:
326 expected_image_locator: locator string pointing at expected image 329 expected_image_locator: locator string pointing at expected image
327 actual_image_locator: locator string pointing at actual image 330 actual_image_locator: locator string pointing at actual image
328 331
329 Returns: already-sanitized locator where the diffs between expected and 332 Returns: already-sanitized locator where the diffs between expected and
330 actual images can be found 333 actual images can be found
331 """ 334 """
332 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator), 335 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator),
333 _sanitize_locator(actual_image_locator)) 336 _sanitize_locator(actual_image_locator))
OLDNEW
« no previous file with comments | « gm/rebaseline_server/compare_to_expectations_test.py ('k') | gm/rebaseline_server/server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698