-
Notifications
You must be signed in to change notification settings - Fork 110
updated default block size #509
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23cd7f8
updated default block size
anjaliratnam-msft 2559f6e
updates
anjaliratnam-msft 1c8d123
updates
anjaliratnam-msft 78e6ef5
updates
anjaliratnam-msft b3c456b
updates
anjaliratnam-msft 7f28bbe
updates
anjaliratnam-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ | |
"is_current_version", | ||
] | ||
_ROOT_PATH = "/" | ||
_DEFAULT_BLOCK_SIZE = 4 * 1024 * 1024 | ||
_DEFAULT_BLOCK_SIZE = 50 * 2**20 | ||
|
||
_SOCKET_TIMEOUT_DEFAULT = object() | ||
|
||
|
@@ -177,8 +177,7 @@ class AzureBlobFileSystem(AsyncFileSystem): | |
The credentials with which to authenticate. Optional if the account URL already has a SAS token. | ||
Can include an instance of TokenCredential class from azure.identity.aio. | ||
blocksize: int | ||
The block size to use for download/upload operations. Defaults to hardcoded value of | ||
``BlockBlobService.MAX_BLOCK_SIZE`` | ||
The block size to use for download/upload operations. Defaults to 50 MiB | ||
client_id: str | ||
Client ID to use when authenticating using an AD Service Principal client/secret. | ||
client_secret: str | ||
|
@@ -1863,7 +1862,8 @@ def _open( | |
What mode to open the file in - defaults to "rb" | ||
|
||
block_size: int | ||
Size per block for multi-part downloads. | ||
Size per block for multi-part uploads and downloads. This overrides the block_size parameter | ||
and if not provided, defaults to the filesystem blocksize. | ||
|
||
autocommit: bool | ||
Whether or not to write to the destination directly | ||
|
@@ -1879,6 +1879,8 @@ def _open( | |
is versioning aware and blob versioning is enabled on the releveant container. | ||
""" | ||
logger.debug(f"_open: {path}") | ||
if block_size is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should make sure to update the
|
||
block_size = self.blocksize | ||
if not self.version_aware and version_id: | ||
raise ValueError( | ||
"version_id cannot be specified if the filesystem " | ||
|
@@ -1901,7 +1903,7 @@ def _open( | |
class AzureBlobFile(AbstractBufferedFile): | ||
"""File-like operations on Azure Blobs""" | ||
|
||
DEFAULT_BLOCK_SIZE = 5 * 2**20 | ||
DEFAULT_BLOCK_SIZE = _DEFAULT_BLOCK_SIZE | ||
|
||
def __init__( | ||
self, | ||
|
@@ -2146,11 +2148,11 @@ async def _async_initiate_upload(self, **kwargs): | |
|
||
_initiate_upload = sync_wrapper(_async_initiate_upload) | ||
|
||
def _get_chunks(self, data, chunk_size=1024**3): # Keeping the chunk size as 1 GB | ||
def _get_chunks(self, data): | ||
start = 0 | ||
length = len(data) | ||
while start < length: | ||
end = min(start + chunk_size, length) | ||
end = min(start + self.blocksize, length) | ||
yield data[start:end] | ||
start = end | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also make sure to update the changelog in this PR. I'm thinking we can just use the three bullet points from this comment I made: #509 (comment) and make the wording a bit more succinct.