data: check checksum before pulling data

Fixes #205

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-09-14 22:24:50 +03:00
parent ce609c5f50
commit cc2dff765b
+7 -3
View File
@@ -614,7 +614,11 @@ class DataCloudGCP(DataCloudBase):
Logger.error('File "{}" does not exist in the cloud'.format(key))
return None
Logger.info('Downloading cache file from gc "{}/{}"'.format(bucket.name, key))
if self._cmp_checksum(blob, fname):
Logger.debug('File "{}" matches with "{}".'.format(fname, key))
return data_item
Logger.debug('Downloading cache file from gc "{}/{}"'.format(bucket.name, key))
# percent_cb is not available for download_to_filename, so
# lets at least update progress at keypoints(start, finish)
@@ -629,7 +633,7 @@ class DataCloudGCP(DataCloudBase):
progress.finish_target(name)
Logger.info('Downloading completed')
Logger.debug('Downloading completed')
return data_item
@@ -654,7 +658,7 @@ class DataCloudGCP(DataCloudBase):
blob.upload_from_filename(data_item.resolved_cache.relative)
progress.finish_target(name)
Logger.info('uploading %s completed' % data_item.resolved_cache.relative)
Logger.debug('uploading %s completed' % data_item.resolved_cache.relative)
return data_item