Index: py/utils/gs_utils.py |
diff --git a/py/utils/gs_utils.py b/py/utils/gs_utils.py |
index fd9999c3872fc4c1d2c7a3492bd2da74c0dc6265..a01d1d4911f1748f64dc068390ba50153df4f47e 100644 |
--- a/py/utils/gs_utils.py |
+++ b/py/utils/gs_utils.py |
@@ -411,7 +411,7 @@ class GSUtils(object): |
q.join() |
def download_file(self, source_bucket, source_path, dest_path, |
- create_subdirs_if_needed=False): |
+ create_subdirs_if_needed=False, source_generation=None): |
"""Downloads a single file from Google Cloud Storage to local disk. |
Args: |
@@ -420,10 +420,13 @@ class GSUtils(object): |
dest_path: full path (local-OS-style) on local disk to copy the file to |
create_subdirs_if_needed: boolean; whether to create subdirectories as |
needed to create dest_path |
+ source_generation: the generation version of the source. |
rmistry
2014/11/04 12:42:53
Nitiest of nits: Please remove the period (to be c
bungeman-skia
2014/11/04 14:36:47
Done.
|
""" |
b = self._connect_to_bucket(bucket=source_bucket) |
key = Key(b) |
key.name = source_path |
+ if (source_generation): |
rmistry
2014/11/04 12:42:52
Surrounding parenthesis not needed ->
if source_g
bungeman-skia
2014/11/04 14:36:47
Done.
|
+ key.generation = source_generation |
if create_subdirs_if_needed: |
_makedirs_if_needed(os.path.dirname(dest_path)) |
with open(dest_path, 'w') as f: |