Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5eca2bb
[storage] Add async APIs for Files SDK (#6405)
annatisch Jul 18, 2019
aba5f69
Async implementation for storage queues. (#6360)
rakshith91 Jul 22, 2019
323cc61
Merge remote-tracking branch 'origin/master' into storage-preview2
annatisch Jul 22, 2019
7a737d5
Merge latest azure-core changes
annatisch Jul 22, 2019
47d063a
Updated shared blob client
annatisch Jul 22, 2019
c755392
Merge remote-tracking branch 'origin/master' into storage-preview2
annatisch Jul 25, 2019
6296b96
add decorator and policy to storage_files and propagate context for i…
SuyogSoti Jul 25, 2019
e08bfc6
Trace storage queue (#6449)
SuyogSoti Jul 25, 2019
6ada100
Trace storage blob (#6478)
SuyogSoti Jul 25, 2019
118d10f
New paging to storage preview2 branch (with async) (#6493)
lmazuel Jul 26, 2019
3f070bb
Fix async tests
lmazuel Jul 26, 2019
1c37b69
Fix continuation token bug
lmazuel Jul 26, 2019
804112c
Merge remote-tracking branch 'upstream/master' into storage-preview2
lmazuel Jul 26, 2019
c6b2151
Support for aiohttp records from vcrpy (#6552)
lmazuel Jul 30, 2019
eb1051c
Async recording for Storage (#6560)
lmazuel Jul 31, 2019
b5a2491
Merge remote-tracking branch 'upstream/master' into storage-preview2
lmazuel Jul 31, 2019
4b64b40
Aiohttp is the only default for async clients (#6561)
lmazuel Jul 31, 2019
03aa8f6
seed tests.yml (#6645)
danieljurek Aug 2, 2019
3acf780
[storage] Blob async APIs (#6489)
annatisch Aug 3, 2019
050fa0c
Merge branch 'master' into storage-preview2
kristapratico Aug 3, 2019
48d2651
Storage Recordings For Queues and Files (#6629)
Aug 4, 2019
254a0d1
allowing specific project targeting for storage livetests
scbedd Aug 5, 2019
ce11dcc
allowing BuildTargetingString to flow through for templates following…
scbedd Aug 5, 2019
55190af
passing service directory to setup task
scbedd Aug 5, 2019
aeec5c9
Merge remote-tracking branch 'origin/master' into storage-preview2
annatisch Aug 5, 2019
17e3eb3
Support for Live storage tests (#6663)
Aug 5, 2019
a93bcdd
[storage] Preview2 updates (#6658)
annatisch Aug 5, 2019
6458fa0
fix test (#6674)
Aug 6, 2019
ca9a0ac
Fix for queue models (#6681)
annatisch Aug 6, 2019
1c44a9c
[storage] Readme tweaks (#6697)
annatisch Aug 6, 2019
5665c17
Some final tweaks (#6687)
Aug 6, 2019
2e614ab
[storage] Better async import error message (#6700)
annatisch Aug 6, 2019
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
Prev Previous commit
Next Next commit
[storage] Preview2 updates (#6658)
* Updated change logs

* Bumped versions

* Some test fixes

* Fix for file handle next marker

* Fixed error in release notes

* Updated core version

* Updated azure-core shared dep

* Updated release notes
  • Loading branch information
annatisch authored Aug 5, 2019
commit a93bcdd910bdeec35e3e06aa4d43421ba78a7724
23 changes: 22 additions & 1 deletion sdk/storage/azure-storage-blob/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,30 @@

## Version 12.0.0b2:

- Added async APIs to subnamespace `azure.storage.blob.aio`.
**Breaking changes**
- Renamed `copy_blob_from_url` to `start_copy_from_url` and changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with the `get_blob_properties` operation.
- Added `abort_copy` operation to the `BlobClient` class. This replaces the previous abort operation on the copy status polling operation.
- The behavior of listing operations has been modified:
- The previous `marker` parameter has been removed.
- The iterable response object now supports a `by_page` function that will return a secondary iterator of batches of results. This function supports a `continuation_token` parameter to replace the previous `marker` parameter.
- Some parameters have become keyword only, rather than positional. Some examples include:
- `timeout`
- `lease`
- `encoding`
- Modification conditions, e.g. `if_modified_since`, `if_match` , `maxsize_condition`, etc

**New features**
- Added async APIs to subnamespace `azure.storage.blob.aio`.
- Distributed tracing framework OpenCensus is now supported.

**Dependency updates**
- Adopted [azure-core](https://pypi.org/project/azure-core/) 1.0.0b2
- If you later want to revert to azure-storage-blob 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you'll need to `pip uninstall azure-core`

**Fixes and improvements**
- Fix for SAS URL encoding (#6500)
- General refactor of duplicate and shared code.


## Version 12.0.0b1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.0.0b1"
VERSION = "12.0.0b2"
13 changes: 9 additions & 4 deletions sdk/storage/azure-storage-blob/tests/test_blob_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import platform

from azure.storage.blob import (
VERSION,
BlobServiceClient,
ContainerClient,
BlobClient,
Expand Down Expand Up @@ -396,7 +397,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -412,7 +414,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -422,7 +425,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -436,7 +440,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-blob/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
13 changes: 9 additions & 4 deletions sdk/storage/azure-storage-blob/tests/test_blob_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import platform
import asyncio

from azure.storage.blob import VERSION
from azure.storage.blob.aio import (
BlobServiceClient,
ContainerClient,
Expand Down Expand Up @@ -418,7 +419,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -438,7 +440,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -448,7 +451,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -466,7 +470,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-blob/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
27 changes: 27 additions & 0 deletions sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Change Log azure-storage-file


## Version 12.0.0b2:

**Breaking changes**
- Renamed `copy_file_from_url` to `start_copy_from_url` and changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with the `get_file_properties` operation.
- Added `abort_copy` operation to the `FileClient` class. This replaces the previous abort operation on the copy status polling operation.
- The behavior of listing operations has been modified:
- The previous `marker` parameter has been removed.
- The iterable response object now supports a `by_page` function that will return a secondary iterator of batches of results. This function supports a `continuation_token` parameter to replace the previous `marker` parameter.
- The new listing behaviour is also adopted by the `receive_messages` operation:
- The receive operation returns a message iterator as before.
- The returned iterator supports a `by_page` operation to receive messages in batches.

**New features**
- Added async APIs to subnamespace `azure.storage.file.aio`.
- Distributed tracing framework OpenCensus is now supported.

**Dependency updates**
- Adopted [azure-core](https://pypi.org/project/azure-core/) 1.0.0b2
- If you later want to revert to azure-storage-file 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you'll need to `pip uninstall azure-core`

**Fixes and improvements**
- Fix for closing file handles - continuation token was not being passed to subsequent calls.
- General refactor of duplicate and shared code.


## Version 12.0.0b1:

Version 12.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Storage Files. For more information about this, and preview releases of other Azure SDK libraries, please visit
Expand Down
12 changes: 6 additions & 6 deletions sdk/storage/azure-storage-file/azure/storage/file/_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ class CloseHandles(PollingMethod):

def __init__(self, interval):
self._command = None
self._status = None
self._continuation_token = None
self._exception = None
self.handles_closed = 0
self.polling_interval = interval

def _update_status(self):
try:
status = self._command() # pylint: disable=protected-access
status = self._command(marker=self._continuation_token)
except StorageErrorException as error:
process_storage_error(error)
self._status = status.get('marker')
self.handles_closed += status['number_of_handles_closed']
self._continuation_token = status.get('marker')
self.handles_closed += status.get('number_of_handles_closed') or 0

def initialize(self, command, initial_status, _): # pylint: disable=arguments-differ
# type: (Any, Any, Callable) -> None
self._command = command
self._status = initial_status['marker']
self._continuation_token = initial_status['marker']
self.handles_closed = initial_status['number_of_handles_closed']

def run(self):
Expand All @@ -57,7 +57,7 @@ def finished(self):
"""Is this polling finished?
:rtype: bool
"""
return self._status is None
return self._continuation_token is None

def resource(self):
# type: () -> Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ class CloseHandlesAsync(AsyncPollingMethod):

def __init__(self, interval):
self._command = None
self._status = None
self._continuation_token = None
self._exception = None
self.handles_closed = 0
self.polling_interval = interval

async def _update_status(self):
try:
status = await self._command() # pylint: disable=protected-access
status = await self._command(marker=self._continuation_token)
except StorageErrorException as error:
process_storage_error(error)
self._status = status.get('marker')
self.handles_closed += status['number_of_handles_closed']
self._continuation_token = status.get('marker')
self.handles_closed += status.get('number_of_handles_closed') or 0

def initialize(self, command, initial_status, _): # pylint: disable=arguments-differ
# type: (Any, Any, Callable) -> None
self._command = command
self._status = initial_status['marker']
self._continuation_token = initial_status['marker']
self.handles_closed = initial_status['number_of_handles_closed']

async def run(self):
Expand All @@ -57,7 +57,7 @@ def finished(self):
"""Is this polling finished?
:rtype: bool
"""
return self._status is None
return self._continuation_token is None

def resource(self):
# type: () -> Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = '12.0.0b1'
VERSION = '12.0.0b2'
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file/tests/test_file_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def setUp(self):
self.fsc2 = FileServiceClient(remote_url, credential=remote_credential, transport=AiohttpTestTransport())
self.remote_share_name = None
loop = asyncio.get_event_loop()
loop.run_until_complete(self.fsc.__aenter__())
loop.run_until_complete(self.fsc2.__aenter__())

def tearDown(self):
if not self.is_playback():
Expand Down
29 changes: 17 additions & 12 deletions sdk/storage/azure-storage-file/tests/test_file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import platform

from azure.storage.file import (
VERSION,
FileServiceClient,
ShareClient,
DirectoryClient,
Expand Down Expand Up @@ -134,7 +135,7 @@ def test_create_service_missing_arguments(self):
for service_type in SERVICES:
# Act
with self.assertRaises(ValueError):
service = service_type(None)
service_type(None)

def test_create_service_with_socket_timeout(self):
# Arrange
Expand Down Expand Up @@ -204,11 +205,11 @@ def test_create_service_with_connection_string_endpoint_protocol(self):
def test_create_service_with_connection_string_emulated(self):
# Arrange
for service_type in SERVICES.items():
conn_string = 'UseDevelopmentStorage=true;'.format(self.account_name, self.account_key)
conn_string = 'UseDevelopmentStorage=true;'

# Act
with self.assertRaises(ValueError):
service = service_type[0].from_connection_string(
service_type[0].from_connection_string(
conn_string, share='foo', directory_path='bar', file_path='baz')

def test_create_service_with_connection_string_fails_if_secondary_without_primary(self):
Expand All @@ -221,7 +222,7 @@ def test_create_service_with_connection_string_fails_if_secondary_without_primar

# Fails if primary excluded
with self.assertRaises(ValueError):
service = service_type[0].from_connection_string(
service_type[0].from_connection_string(
conn_string, share='foo', directory_path='bar', file_path='baz')

def test_create_service_with_connection_string_succeeds_if_secondary_with_primary(self):
Expand Down Expand Up @@ -251,7 +252,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -263,25 +265,27 @@ def test_user_agent_custom(self):
service = FileServiceClient(
self.get_file_url(), credential=self.account_key, user_agent=custom_app)

def callback(response):
def callback1(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

service.get_service_properties(raw_response_hook=callback)
service.get_service_properties(raw_response_hook=callback1)

def callback(response):
def callback2(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

service.get_service_properties(raw_response_hook=callback, user_agent="TestApp/v2.0")
service.get_service_properties(raw_response_hook=callback2, user_agent="TestApp/v2.0")

@record
def test_user_agent_append(self):
Expand All @@ -291,7 +295,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-file/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-file/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
Loading