Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not spam the log with checksum related INFO messages when downloading using transfer_manager #1357

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google/cloud/storage/transfer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ def download_chunks_concurrently(
"'checksum' is in download_kwargs, but is not supported because sliced downloads have a different checksum mechanism from regular downloads. Use the 'crc32c_checksum' argument on download_chunks_concurrently instead."
)

download_kwargs = download_kwargs.copy()
download_kwargs["checksum"] = None
download_kwargs["command"] = "tm.download_sharded"

# We must know the size and the generation of the blob.
Expand Down
7 changes: 1 addition & 6 deletions tests/unit/test_transfer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ def test_download_chunks_concurrently():

expected_download_kwargs = EXPECTED_DOWNLOAD_KWARGS.copy()
expected_download_kwargs["command"] = "tm.download_sharded"
expected_download_kwargs["checksum"] = None

with mock.patch("google.cloud.storage.transfer_manager.open", mock.mock_open()):
result = transfer_manager.download_chunks_concurrently(
Expand Down Expand Up @@ -636,9 +637,6 @@ def test_download_chunks_concurrently_with_crc32c():
blob_mock.size = len(BLOB_CONTENTS)
blob_mock.crc32c = "eOVVVw=="

expected_download_kwargs = EXPECTED_DOWNLOAD_KWARGS.copy()
expected_download_kwargs["command"] = "tm.download_sharded"

def write_to_file(f, *args, **kwargs):
f.write(BLOB_CHUNK)

Expand All @@ -664,9 +662,6 @@ def test_download_chunks_concurrently_with_crc32c_failure():
blob_mock.size = len(BLOB_CONTENTS)
blob_mock.crc32c = "invalid"

expected_download_kwargs = EXPECTED_DOWNLOAD_KWARGS.copy()
expected_download_kwargs["command"] = "tm.download_sharded"

def write_to_file(f, *args, **kwargs):
f.write(BLOB_CHUNK)

Expand Down