Skip to content

Commit

Permalink
gs download idea
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Nov 17, 2019
1 parent 6b388ed commit 1f442a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dvc/remote/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1f442a4

Please sign in to comment.