Commit ba97e73f authored by tbarzic@chromium.org's avatar tbarzic@chromium.org

Adds extra logging to telemetry in hope it helps diagnose issue 351143

It seems there is a problem running gsutil on cros dtus, so adding few
extra log statements around that code.

BUG=351143

Review URL: https://codereview.chromium.org/298863016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272838 0039d316-1c4b-4281-b951-d872f2087c98
parent 15d92065
...@@ -173,10 +173,12 @@ def GetIfChanged(file_path, bucket=None): ...@@ -173,10 +173,12 @@ def GetIfChanged(file_path, bucket=None):
""" """
hash_path = file_path + '.sha1' hash_path = file_path + '.sha1'
if not os.path.exists(hash_path): if not os.path.exists(hash_path):
logging.warning('Hash file not found: %s' % hash_path)
return False return False
expected_hash = ReadHash(hash_path) expected_hash = ReadHash(hash_path)
if os.path.exists(file_path) and CalculateHash(file_path) == expected_hash: if os.path.exists(file_path) and CalculateHash(file_path) == expected_hash:
logging.info('File up to date: %s' % file_path)
return False return False
if bucket: if bucket:
...@@ -188,6 +190,7 @@ def GetIfChanged(file_path, bucket=None): ...@@ -188,6 +190,7 @@ def GetIfChanged(file_path, bucket=None):
for bucket in buckets: for bucket in buckets:
try: try:
url = 'gs://%s/%s' % (bucket, expected_hash) url = 'gs://%s/%s' % (bucket, expected_hash)
logging.info('Running gsutil command: cp %s %s' % (url, file_path))
_RunCommand(['cp', url, file_path]) _RunCommand(['cp', url, file_path])
logging.info('Downloaded %s to %s' % (url, file_path)) logging.info('Downloaded %s to %s' % (url, file_path))
found = True found = True
......
...@@ -8,6 +8,7 @@ import os ...@@ -8,6 +8,7 @@ import os
import re import re
import shutil import shutil
from telemetry.core.backends.chrome import cros_interface
from telemetry.page import cloud_storage from telemetry.page import cloud_storage
...@@ -22,16 +23,28 @@ class PageSetArchiveInfo(object): ...@@ -22,16 +23,28 @@ class PageSetArchiveInfo(object):
# Download all .wpr files. # Download all .wpr files.
if not ignore_archive: if not ignore_archive:
# TODO(tbarzic): Remove this once http://crbug.com/351143 is diagnosed.
log_cloud_storage_exception = cros_interface.IsRunningOnCrosDevice()
for archive_path in data['archives']: for archive_path in data['archives']:
archive_path = self._WprFileNameToPath(archive_path) archive_path = self._WprFileNameToPath(archive_path)
try: try:
cloud_storage.GetIfChanged(archive_path) cloud_storage.GetIfChanged(archive_path)
except (cloud_storage.CredentialsError, cloud_storage.PermissionError): except (cloud_storage.CredentialsError,
cloud_storage.PermissionError) as e:
if os.path.exists(archive_path): if os.path.exists(archive_path):
# If the archive exists, assume the user recorded their own and # If the archive exists, assume the user recorded their own and
# simply warn. # simply warn.
logging.warning('Need credentials to update WPR archive: %s', logging.warning('Need credentials to update WPR archive: %s',
archive_path) archive_path)
elif log_cloud_storage_exception:
# Log access errors only once, as they should stay the same in other
# iterations.
log_cloud_storage_exception = False
logging.warning('Error getting WPR archive %s: %s ' %
(archive_path, str(e)))
logging.info(
'HOME: "%s"; USER: "%s"' %
(os.environ.get('HOME', ''), os.environ.get('USER', '')))
# Map from the relative path (as it appears in the metadata file) of the # Map from the relative path (as it appears in the metadata file) of the
# .wpr file to a list of page names it supports. # .wpr file to a list of page names it supports.
...@@ -53,6 +66,9 @@ class PageSetArchiveInfo(object): ...@@ -53,6 +66,9 @@ class PageSetArchiveInfo(object):
with open(file_path, 'r') as f: with open(file_path, 'r') as f:
data = json.load(f) data = json.load(f)
return cls(file_path, data, ignore_archive=ignore_archive) return cls(file_path, data, ignore_archive=ignore_archive)
# TODO(tbarzic): Remove this once http://crbug.com/351143 is diagnosed.
if cros_interface.IsRunningOnCrosDevice():
logging.warning('Page set archives not found: %s' % file_path)
return cls(file_path, {'archives': {}}, ignore_archive=ignore_archive) return cls(file_path, {'archives': {}}, ignore_archive=ignore_archive)
def WprFilePathForPage(self, page): def WprFilePathForPage(self, page):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment