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

Unified Diff: tools/telemetry/telemetry/util/cloud_storage.py

Issue 1005903004: Revert of Refactor serving_dirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
Index: tools/telemetry/telemetry/util/cloud_storage.py
diff --git a/tools/telemetry/telemetry/util/cloud_storage.py b/tools/telemetry/telemetry/util/cloud_storage.py
index 1e9fc4f9831455c249b8a9b3588d5a632b71843d..ed97ccbb4837bcbab573b4fab844fc0898e9c1f1 100644
--- a/tools/telemetry/telemetry/util/cloud_storage.py
+++ b/tools/telemetry/telemetry/util/cloud_storage.py
@@ -15,7 +15,6 @@
import tarfile
import urllib2
-from telemetry import decorators
from telemetry.core import util
from telemetry.util import path
@@ -221,8 +220,10 @@
def GetIfChanged(file_path, bucket):
- """Gets the file at file_path if it has a hash file that doesn't match or
- if there is no local copy of file_path, but there is a hash file for it.
+ """Gets the file at file_path if it has a hash file that doesn't match.
+
+ If the file is not in Cloud Storage, log a warning instead of raising an
+ exception. We assume that the user just hasn't uploaded the file yet.
Returns:
True if the binary was changed.
@@ -243,25 +244,6 @@
Get(bucket, expected_hash, file_path)
return True
-# TODO(aiolos): remove @decorators.Cache for http://crbug.com/459787
-@decorators.Cache
-def GetFilesInDirectoryIfChanged(directory, bucket):
- """ Scan the directory for .sha1 files, and download them from the given
- bucket in cloud storage if the local and remote hash don't match or
- there is no local copy.
- """
- if not os.path.isdir(directory):
- raise ValueError('Must provide a valid directory.')
- # Don't allow the root directory to be a serving_dir.
- if directory == os.path.abspath(os.sep):
- raise ValueError('Trying to serve root directory from HTTP server.')
- for dirpath, _, filenames in os.walk(directory):
- for filename in filenames:
- path_name, extension = os.path.splitext(
- os.path.join(dirpath, filename))
- if extension != '.sha1':
- continue
- GetIfChanged(path_name, bucket)
def CalculateHash(file_path):
"""Calculates and returns the hash of the file at file_path."""
« no previous file with comments | « tools/telemetry/telemetry/user_story/user_story_set.py ('k') | tools/telemetry/telemetry/util/cloud_storage_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698