def _load_cachefiles_via_fs(self, project, cachefiles): rv = {} base = self.get_project_path(project) for debug_id, model, cache in cachefiles: # If we're given a cache instance, use that over accessing the file # system or potentially even blob storage. if cache is not None: rv[debug_id] = cache continue elif model is None: raise RuntimeError('missing symcache file to load from fs') # Try to locate a cached instance from the file system and bump the # timestamp to indicate it is still being used. Otherwise, download # from the blob store and place it in the cache folder. cachefile_name = '%s_%s.symcache' % (model.id, model.version) cachefile_path = os.path.join(base, cachefile_name) try: stat = os.stat(cachefile_path) except OSError as e: if e.errno != errno.ENOENT: raise model.cache_file.save_to(cachefile_path) else: now = int(time.time()) if stat.st_ctime < now - ONE_DAY: os.utime(cachefile_path, (now, now)) rv[debug_id] = SymCache.from_path(cachefile_path) return rv
def _load_cachefiles_via_fs(self, project, cachefiles): rv = {} base = self.get_project_path(project) for dsym_id, symcache_file in cachefiles: cachefile_path = os.path.join(base, dsym_id + '.symcache') try: stat = os.stat(cachefile_path) except OSError as e: if e.errno != errno.ENOENT: raise symcache_file.cache_file.save_to(cachefile_path) else: self._try_bump_timestamp(cachefile_path, stat) rv[dsym_id] = SymCache.from_path(cachefile_path) return rv
def _load_cachefiles_via_fs(self, project, cachefiles): rv = {} base = self.get_project_path(project) for dsym_uuid, symcache_file in cachefiles: cachefile_path = os.path.join(base, dsym_uuid + '.symcache') try: stat = os.stat(cachefile_path) except OSError as e: if e.errno != errno.ENOENT: raise symcache_file.cache_file.save_to(cachefile_path) else: self._try_bump_timestamp(cachefile_path, stat) rv[uuid.UUID(dsym_uuid)] = SymCache.from_path(cachefile_path) return rv