in src/s3_util.py [0:0]
def download_files(self, remote_path, local_dir, num_threads=8, quite_mode=True):
"""
Downloads the files from s3 to local directory
:param quite_mode: If False, prints the status of each file downloaded
:param remote_path: The remote s3 path prefix
:param local_dir: The local directory
:param num_threads: The number of parallel downloads
"""
lp = lambda b, k, r, l: os.path.join(l, *("s3://{}/{}".format(b, k).replace(r, "").split("/")[0:-1]))
input_tuples = (
("s3://{}/{}".format(s3_bucket, s3_key), lp(s3_bucket, s3_key, remote_path, local_dir), quite_mode) for
s3_bucket, s3_key in
self.list_files(remote_path))
with ThreadPool(num_threads) as pool:
pool.starmap(self.download_file, input_tuples)