From 1f442a4732ee1b2245003f9e044b01c8e23a7407 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 17 Nov 2019 23:29:45 +0000 Subject: [PATCH] gs download idea --- dvc/remote/gs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dvc/remote/gs.py b/dvc/remote/gs.py index fb3402492b..8584309350 100644 --- a/dvc/remote/gs.py +++ b/dvc/remote/gs.py @@ -143,7 +143,16 @@ def _upload(self, from_file, to_info, **_kwargs): def _download(self, from_info, to_file, **_kwargs): bucket = self.gs.bucket(from_info.bucket) blob = bucket.get_blob(from_info.path) - blob.download_to_filename(to_file) + with Tqdm() as pbar: + with io.open(to_file, mode="wb") as fd: + raw_write = fd.write + + def write(bytes): + raw_write(bytes) + pbar.update(len(bytes)) + + fd.write = write + blob.download_to_file(fd) def _generate_download_url(self, path_info, expires=3600): expiration = timedelta(seconds=int(expires))