Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin):
legal_hold: Optional[bool] = None,
standard_blob_tier: Optional[StandardBlobTier] = None,
maxsize_condition: Optional[int] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
Comment thread
nateprewitt marked this conversation as resolved.
cpk: Optional[CustomerProvidedEncryptionKey] = None,
encryption_scope: Optional[str] = None,
encoding: str = "UTF-8",
Expand All @@ -208,7 +208,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin):
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: str,
progress_hook: Optional[Callable[[int, int], None]] = None,
decompress: Optional[bool] = None,
Expand All @@ -230,7 +230,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin):
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: None = None,
progress_hook: Optional[Callable[[int, int], None]] = None,
decompress: Optional[bool] = None,
Expand All @@ -252,7 +252,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin):
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: Optional[str] = None,
progress_hook: Optional[Callable[[int, int], None]] = None,
decompress: Optional[bool] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
)
from ._shared import encode_base64
from ._shared.base_client import parse_query
from ._shared.constants import DEFAULT_MAX_CONCURRENCY
from ._shared.request_handlers import (
add_metadata_headers,
get_length,
Expand Down Expand Up @@ -137,7 +138,9 @@ def _upload_blob_options( # pylint:disable=too-many-statements
validate_content = kwargs.pop('validate_content', False)
content_settings = kwargs.pop('content_settings', None)
overwrite = kwargs.pop('overwrite', False)
max_concurrency = kwargs.pop('max_concurrency', 1)
max_concurrency = kwargs.pop('max_concurrency', None)
Comment thread
nateprewitt marked this conversation as resolved.
if max_concurrency is None:
max_concurrency = DEFAULT_MAX_CONCURRENCY
Comment thread
nateprewitt marked this conversation as resolved.
cpk = kwargs.pop('cpk', None)
cpk_info = None
if cpk:
Expand Down Expand Up @@ -323,7 +326,7 @@ def _download_blob_options(
'modified_access_conditions': mod_conditions,
'cpk_info': cpk_info,
'download_cls': kwargs.pop('cls', None) or deserialize_blob_stream,
'max_concurrency':kwargs.pop('max_concurrency', 1),
'max_concurrency':kwargs.pop('max_concurrency', None) or DEFAULT_MAX_CONCURRENCY,
Comment thread
nateprewitt marked this conversation as resolved.
Outdated
Comment thread
nateprewitt marked this conversation as resolved.
Outdated
'encoding': encoding,
'timeout': kwargs.pop('timeout', None),
'name': blob_name,
Expand Down
17 changes: 9 additions & 8 deletions sdk/storage/azure-storage-blob/azure/storage/blob/_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from ._shared.request_handlers import validate_and_format_range_headers
from ._shared.response_handlers import parse_length_from_content_range, process_storage_error
from ._shared.constants import DEFAULT_MAX_CONCURRENCY
from ._deserialize import deserialize_blob_properties, get_page_ranges_result
from ._encryption import (
adjust_blob_size_for_encryption,
Expand Down Expand Up @@ -330,7 +331,7 @@ def __init__(
end_range: Optional[int] = None,
validate_content: bool = None, # type: ignore [assignment]
encryption_options: Dict[str, Any] = None, # type: ignore [assignment]
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
name: str = None, # type: ignore [assignment]
container: str = None, # type: ignore [assignment]
encoding: Optional[str] = None,
Expand All @@ -345,7 +346,7 @@ def __init__(
self._config = config
self._start_range = start_range
self._end_range = end_range
self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
self._encoding = encoding
self._validate_content = validate_content
self._encryption_options = encryption_options or {}
Expand Down Expand Up @@ -865,7 +866,7 @@ def _check_and_report_progress(self):
if self._progress_hook and self._current_content_offset == len(self._current_content):
self._progress_hook(self._download_offset, self.size)

def content_as_bytes(self, max_concurrency=1):
def content_as_bytes(self, max_concurrency=None):
"""DEPRECATED: Download the contents of this file.

This operation is blocking until all data is downloaded.
Expand All @@ -885,10 +886,10 @@ def content_as_bytes(self, max_concurrency=1):
raise ValueError("Stream has been partially read in text mode. "
"content_as_bytes is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
return self.readall()

def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
def content_as_text(self, max_concurrency=None, encoding="UTF-8"):
"""DEPRECATED: Download the contents of this blob, and decode as text.

This operation is blocking until all data is downloaded.
Expand All @@ -910,11 +911,11 @@ def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
raise ValueError("Stream has been partially read in text mode. "
"content_as_text is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
self._encoding = encoding
return self.readall()

def download_to_stream(self, stream, max_concurrency=1):
def download_to_stream(self, stream, max_concurrency=None):
"""DEPRECATED: Download the contents of this blob to a stream.

This method is deprecated, use func:`readinto` instead.
Expand All @@ -936,6 +937,6 @@ def download_to_stream(self, stream, max_concurrency=1):
raise ValueError("Stream has been partially read in text mode. "
"download_to_stream is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
self.readinto(stream)
return self.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
READ_TIMEOUT = 60
DATA_BLOCK_SIZE = 256 * 1024

DEFAULT_MAX_CONCURRENCY = 1
Comment thread
nateprewitt marked this conversation as resolved.

DEFAULT_OAUTH_SCOPE = "/.default"
STORAGE_OAUTH_SCOPE = "https://storage.azure.com/.default"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class BlobClient( # type: ignore[misc]
legal_hold: Optional[bool] = None,
standard_blob_tier: Optional[StandardBlobTier] = None,
maxsize_condition: Optional[int] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
encryption_scope: Optional[str] = None,
encoding: str = "UTF-8",
Expand All @@ -210,7 +210,7 @@ class BlobClient( # type: ignore[misc]
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: str,
progress_hook: Optional[Callable[[int, int], Awaitable[None]]] = None,
decompress: Optional[bool] = None,
Expand All @@ -232,7 +232,7 @@ class BlobClient( # type: ignore[misc]
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: None = None,
progress_hook: Optional[Callable[[int, int], Awaitable[None]]] = None,
decompress: Optional[bool] = None,
Expand All @@ -254,7 +254,7 @@ class BlobClient( # type: ignore[misc]
match_condition: Optional[MatchConditions] = None,
if_tags_match_condition: Optional[str] = None,
cpk: Optional[CustomerProvidedEncryptionKey] = None,
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
encoding: Optional[str] = None,
progress_hook: Optional[Callable[[int, int], Awaitable[None]]] = None,
decompress: Optional[bool] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from .._shared.request_handlers import validate_and_format_range_headers
from .._shared.response_handlers import parse_length_from_content_range, process_storage_error
from .._shared.constants import DEFAULT_MAX_CONCURRENCY
from .._deserialize import deserialize_blob_properties, get_page_ranges_result
from .._download import process_range_and_offset, _ChunkDownloader
from .._encryption import (
Expand Down Expand Up @@ -239,7 +240,7 @@ def __init__(
end_range: Optional[int] = None,
validate_content: bool = None, # type: ignore [assignment]
encryption_options: Dict[str, Any] = None, # type: ignore [assignment]
max_concurrency: int = 1,
max_concurrency: Optional[int] = None,
name: str = None, # type: ignore [assignment]
container: str = None, # type: ignore [assignment]
encoding: Optional[str] = None,
Expand All @@ -254,7 +255,7 @@ def __init__(
self._config = config
self._start_range = start_range
self._end_range = end_range
self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
Comment thread
nateprewitt marked this conversation as resolved.
self._encoding = encoding
self._validate_content = validate_content
self._encryption_options = encryption_options or {}
Expand Down Expand Up @@ -808,7 +809,7 @@ async def _check_and_report_progress(self):
if self._progress_hook and self._current_content_offset == len(self._current_content):
await self._progress_hook(self._download_offset, self.size)

async def content_as_bytes(self, max_concurrency=1):
async def content_as_bytes(self, max_concurrency=None):
"""DEPRECATED: Download the contents of this file.

This operation is blocking until all data is downloaded.
Expand All @@ -828,10 +829,10 @@ async def content_as_bytes(self, max_concurrency=1):
raise ValueError("Stream has been partially read in text mode. "
"content_as_bytes is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
return await self.readall()

async def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
async def content_as_text(self, max_concurrency=None, encoding="UTF-8"):
"""DEPRECATED: Download the contents of this blob, and decode as text.

This operation is blocking until all data is downloaded.
Expand All @@ -853,11 +854,11 @@ async def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
raise ValueError("Stream has been partially read in text mode. "
"content_as_text is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
self._encoding = encoding
return await self.readall()

async def download_to_stream(self, stream, max_concurrency=1):
async def download_to_stream(self, stream, max_concurrency=None):
"""DEPRECATED: Download the contents of this blob to a stream.

This method is deprecated, use func:`readinto` instead.
Expand All @@ -879,6 +880,6 @@ async def download_to_stream(self, stream, max_concurrency=1):
raise ValueError("Stream has been partially read in text mode. "
"download_to_stream is not supported in text mode.")

self._max_concurrency = max_concurrency
self._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
await self.readinto(stream)
return self.properties