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

Unified Diff: tools/telemetry/telemetry/page/page_set_archive_info.py

Issue 21684002: [telemetry] Automatic hash file creation and upload to Cloud Storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/page_set_archive_info.py
diff --git a/tools/telemetry/telemetry/page/page_set_archive_info.py b/tools/telemetry/telemetry/page/page_set_archive_info.py
index 73c2f5fd65822063a820e480002a92d21e4face5..33502d8608658ba3c4ba15c586979459be13b502 100644
--- a/tools/telemetry/telemetry/page/page_set_archive_info.py
+++ b/tools/telemetry/telemetry/page/page_set_archive_info.py
@@ -7,6 +7,15 @@ import os
import re
import shutil
+from telemetry.page import cloud_storage
+
+
+def _UpdateHashFile(file_path):
+ with open(file_path + '.sha1', 'wb') as f:
+ f.write(cloud_storage.GetHash(file_path))
+ f.flush()
+
+
class PageSetArchiveInfo(object):
def __init__(self, archive_data_file_path, page_set_file_path, data):
self._archive_data_file_path = archive_data_file_path
@@ -52,6 +61,7 @@ class PageSetArchiveInfo(object):
for url in urls:
self._SetWprFileForPage(url, target_wpr_file)
shutil.move(self.temp_target_wpr_file_path, target_wpr_file_path)
+ _UpdateHashFile(target_wpr_file_path)
tonyg 2013/08/02 02:21:52 Would be nice to add an additional assertion to th
dtu 2013/08/02 23:19:58 Done.
self._WriteToFile()
self._DeleteAbandonedWprFiles()
@@ -85,7 +95,7 @@ class PageSetArchiveInfo(object):
metadata['page_set'] = os.path.relpath(self._page_set_file_path,
self._archive_data_file_dir)
metadata['archives'] = self._wpr_file_to_urls.copy()
- # Don't write data for abandones archives.
+ # Don't write data for abandoned archives.
abandoned_wpr_files = self._AbandonedWprFiles()
for wpr_file in abandoned_wpr_files:
del metadata['archives'][wpr_file]
@@ -93,6 +103,7 @@ class PageSetArchiveInfo(object):
with open(self._archive_data_file_path, 'w') as f:
json.dump(metadata, f, indent=4)
f.flush()
+ _UpdateHashFile(self._archive_data_file_path)
def _WprFileNameToPath(self, wpr_file):
return os.path.abspath(os.path.join(self._archive_data_file_dir, wpr_file))
« tools/perf/page_sets/.gitignore ('K') | « tools/telemetry/telemetry/page/cloud_storage.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698