зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636886 - Only download conditioned-profiles once in Raptor. r=tarek,perftest-reviewers,Bebe
This patch makes it so that we only download and extract the conditioned-profile once and have tests use copies of that original copy. It also adds some debugging logs to the condprof `download_file` function to debug an issue where we seem to hit a cache-miss when we have already downloaded the artifact. Differential Revision: https://phabricator.services.mozilla.com/D75176
This commit is contained in:
Родитель
09d946f81d
Коммит
9e71053fad
|
@ -202,10 +202,12 @@ def download_file(url, target=None):
|
|||
if target is None:
|
||||
target = url.split("/")[-1]
|
||||
|
||||
logger.info("Checking for existence of: %s" % target)
|
||||
if os.path.exists(target):
|
||||
# XXX for now, reusing downloads without checking them
|
||||
# when we don't have an .etag file
|
||||
if etag is None or not os.path.exists(target + ".etag"):
|
||||
logger.info("No existing etag downloads.")
|
||||
return target
|
||||
with open(target + ".etag") as f:
|
||||
current_etag = f.read()
|
||||
|
@ -215,6 +217,16 @@ def download_file(url, target=None):
|
|||
return target
|
||||
else:
|
||||
logger.info("Changed!")
|
||||
else:
|
||||
logger.info("Could not find an existing archive.")
|
||||
# Add some debugging logs for the directory content
|
||||
try:
|
||||
archivedir = os.path.dirname(target)
|
||||
logger.info(
|
||||
"Content in cache directory %s: %s" % (archivedir, os.listdir(archivedir))
|
||||
)
|
||||
except Exception:
|
||||
logger.info("Failed to list cache directory contents")
|
||||
|
||||
logger.info("Downloading %s" % url)
|
||||
req = requests.get(url, stream=True, timeout=DOWNLOAD_TIMEOUT)
|
||||
|
|
|
@ -211,9 +211,21 @@ either Raptor or browsertime."""
|
|||
def is_localhost(self):
|
||||
return self.config.get("host") in ("localhost", "127.0.0.1")
|
||||
|
||||
@property
|
||||
def conditioned_profile_copy(self):
|
||||
"""Returns a copy of the original conditioned profile that was created."""
|
||||
condprof_copy = os.path.join(self._get_temp_dir(), "profile")
|
||||
shutil.copytree(self.conditioned_profile_dir, condprof_copy)
|
||||
LOG.info("Created a conditioned-profile copy: %s" % condprof_copy)
|
||||
return condprof_copy
|
||||
|
||||
def get_conditioned_profile(self):
|
||||
"""Downloads a platform-specific conditioned profile, using the
|
||||
condprofile client API; returns a self.conditioned_profile_dir"""
|
||||
if self.conditioned_profile_dir:
|
||||
# We already have a directory, so provide a copy that
|
||||
# will get deleted after it's done with
|
||||
return self.conditioned_profile_copy
|
||||
|
||||
# create a temp file to help ensure uniqueness
|
||||
temp_download_dir = self._get_temp_dir()
|
||||
|
@ -285,20 +297,19 @@ either Raptor or browsertime."""
|
|||
raise OSError
|
||||
|
||||
LOG.info(
|
||||
"self.conditioned_profile_dir is now set: {}".format(
|
||||
"Original self.conditioned_profile_dir is now set: {}".format(
|
||||
self.conditioned_profile_dir
|
||||
)
|
||||
)
|
||||
return self.conditioned_profile_dir
|
||||
return self.conditioned_profile_copy
|
||||
|
||||
def build_browser_profile(self):
|
||||
if not self.using_condprof or self.config['app'] in ['chrome', 'chromium', 'chrome-m']:
|
||||
self.profile = create_profile(self.profile_class)
|
||||
else:
|
||||
self.get_conditioned_profile()
|
||||
# use mozprofile to create a profile for us, from our conditioned profile's path
|
||||
self.profile = create_profile(
|
||||
self.profile_class, profile=self.conditioned_profile_dir
|
||||
self.profile_class, profile=self.get_conditioned_profile()
|
||||
)
|
||||
# Merge extra profile data from testing/profiles
|
||||
with open(os.path.join(self.profile_data_dir, "profiles.json"), "r") as fh:
|
||||
|
|
Загрузка…
Ссылка в новой задаче