예제 #1
0
 def download_package(self, package_file: str):
     if not self.force_download and os.path.exists(
             Packages.path(package_file)):
         return
     url = self.template.format_map({
         **self._common, "package": package_file
     })
     dowload_build_with_progress(url, Packages.path(package_file))
예제 #2
0
    def download_package(self, package_file: str, s3_path_suffix: str):
        path = Packages.path(package_file)
        fallback_path = Packages.fallback_to_all(path)
        if not self.force_download and (os.path.exists(path)
                                        or os.path.exists(fallback_path)):
            if os.path.exists(fallback_path):
                self.packages.replace_with_fallback(package_file)

            return
        url = self.template.format_map({
            **self._common, "s3_path_suffix":
            s3_path_suffix
        })
        try:
            dowload_build_with_progress(url, path)
        except Exception as e:
            if "Cannot download dataset from" in e.args[0]:
                new_url = Packages.fallback_to_all(url)
                logging.warning("Fallback downloading %s for old release",
                                fallback_path)
                dowload_build_with_progress(new_url, fallback_path)
                self.packages.replace_with_fallback(package_file)
예제 #3
0
 def download_package(self, package):
     url = self.template.format_map({**self._common, "package": package})
     dowload_build_with_progress(url, Packages.path(package))