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

Unified Diff: tools/isolate/run_test_from_archive.py

Issue 10392110: Better Cache Additional and Removal (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/run_test_from_archive.py
diff --git a/tools/isolate/run_test_from_archive.py b/tools/isolate/run_test_from_archive.py
index 2223908f2500a43f6b52baf654af25dfe4cefa5d..13ded87aa6f0b82832013369609d40c169ecc6f0 100755
--- a/tools/isolate/run_test_from_archive.py
+++ b/tools/isolate/run_test_from_archive.py
@@ -188,14 +188,20 @@ class Cache(object):
self.min_free_space and
self.state and
get_free_space(self.cache_dir) < self.min_free_space):
- os.remove(self.path(self.state.pop(0)))
+ try:
+ os.remove(self.path(self.state.pop(0)))
+ except OSError as e:
+ logging.error('Error attempting to delete a file\n%s' % e)
# Ensure maximum cache size.
if self.max_cache_size and self.state:
sizes = [os.stat(self.path(f)).st_size for f in self.state]
while sizes and sum(sizes) > self.max_cache_size:
# Delete the oldest item.
- os.remove(self.path(self.state.pop(0)))
+ try:
+ os.remove(self.path(self.state.pop(0)))
+ except OSError as e:
+ logging.error('Error attempting to delete a file\n%s' % e)
sizes.pop(0)
self.save()
@@ -212,7 +218,10 @@ class Cache(object):
except ValueError:
out = self.path(item)
download_or_copy(os.path.join(self.remote, item), out)
- self.state.append(item)
+ if os.path.exists(out):
+ self.state.append(item)
+ else:
+ logging.error('File, %s, not placed in cache' % item)
return True
finally:
self.save()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698