Skip to content

Commit ad78273

Browse files
committed
Add file size assertion
1 parent b975ab7 commit ad78273

File tree

1 file changed

+7
-4
lines changed
  • v03_pipeline/lib/reference_datasets

1 file changed

+7
-4
lines changed

v03_pipeline/lib/reference_datasets/misc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@ def copy_to_cloud_storage(file_name: str) -> str:
176176
if not Env.HAIL_TMP_DIR.startswith('gs://'):
177177
return file_name
178178
if os.path.isdir(file_name):
179-
path = os.path.join(Env.HAIL_TMP_DIR, file_name.lstrip('/'))
179+
cloud_storage_path = os.path.join(Env.HAIL_TMP_DIR, file_name.lstrip('/'))
180180
else:
181-
path = os.path.join(Env.HAIL_TMP_DIR, os.path.basename(file_name))
182-
hfs.copy(file_name, path)
183-
return path
181+
cloud_storage_path = os.path.join(Env.HAIL_TMP_DIR, os.path.basename(file_name))
182+
hfs.copy(file_name, cloud_storage_path)
183+
if os.path.getsize(file_name) != hfs.stat(cloud_storage_path).size:
184+
msg = 'Local and Cloud storage file sizes differ'
185+
raise AssertionError(msg)
186+
return cloud_storage_path

0 commit comments

Comments
 (0)