-
Notifications
You must be signed in to change notification settings - Fork 1.6k
{Spring} Remove DATA_COSMOS_TABLE and DATA_STORAGE references #9085
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
7 commits
Select commit
Hold shift + click to select a range
6b19e41
Remove DATA_COSMOS_TABLE and DATA_STORAGE references from spring, no …
calvinhzy e9efe7a
fix some lint/test error
calvinhzy 678f23d
not able to rerun tests as New customers are not allowed to create Az…
calvinhzy d16391e
marking some tests as live only as it is failing intermittently
calvinhzy dc52a7c
marking some tests as live only as it is failing intermittently
calvinhzy 497590d
marking some tests as live only as it is failing intermittently
calvinhzy 530d2c0
Fix formatting in breaking_change.py
calvinhzy 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
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
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,17 +12,17 @@ | |||||||
| from knack.util import CLIError | ||||||||
| from knack.log import get_logger | ||||||||
| from azure.core.exceptions import HttpResponseError | ||||||||
| from azure.multiapi.storage.v2018_11_09.blob import AppendBlobService | ||||||||
| from azure.cli.core.profiles import ResourceType, get_sdk | ||||||||
| from azure.common import AzureHttpError | ||||||||
| from ._utils import get_blob_info | ||||||||
|
|
||||||||
| logger = get_logger(__name__) | ||||||||
|
|
||||||||
| DEFAULT_CHUNK_SIZE = 1024 * 4 | ||||||||
| DEFAULT_LOG_TIMEOUT_IN_SEC = 60 * 30 # 30 minutes | ||||||||
|
|
||||||||
|
|
||||||||
| def stream_logs(client, | ||||||||
| def stream_logs(cmd, | ||||||||
| client, | ||||||||
| resource_group, | ||||||||
| service, | ||||||||
| app, | ||||||||
|
|
@@ -47,18 +47,13 @@ def stream_logs(client, | |||||||
| logger.warning("%s Empty SAS URL.", error_msg) | ||||||||
| raise CLIError(error_msg) | ||||||||
|
|
||||||||
| account_name, endpoint_suffix, container_name, blob_name, sas_token = get_blob_info( | ||||||||
| log_file_sas) | ||||||||
| BlobClient = get_sdk(cmd.cli_ctx, ResourceType.DATA_STORAGE_BLOB, '_blob_client#BlobClient') | ||||||||
| blob_client = BlobClient.from_blob_url(log_file_sas) | ||||||||
|
|
||||||||
| _stream_logs(no_format, | ||||||||
| DEFAULT_CHUNK_SIZE, | ||||||||
| DEFAULT_LOG_TIMEOUT_IN_SEC, | ||||||||
| AppendBlobService( | ||||||||
| account_name=account_name, | ||||||||
| sas_token=sas_token, | ||||||||
| endpoint_suffix=endpoint_suffix), | ||||||||
| container_name, | ||||||||
| blob_name, | ||||||||
| blob_client, | ||||||||
| raise_error_on_failure, | ||||||||
| logger_level_func) | ||||||||
|
|
||||||||
|
|
@@ -67,8 +62,6 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme | |||||||
| byte_size, | ||||||||
| timeout_in_seconds, | ||||||||
| blob_service, | ||||||||
| container_name, | ||||||||
| blob_name, | ||||||||
| raise_error_on_failure, | ||||||||
| logger_level_func): | ||||||||
|
|
||||||||
|
|
@@ -78,7 +71,6 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme | |||||||
| stream = BytesIO() | ||||||||
| metadata = {} | ||||||||
| start = 0 | ||||||||
| end = byte_size - 1 | ||||||||
| available = 0 | ||||||||
| sleep_time = 1 | ||||||||
| max_sleep_time = 15 | ||||||||
|
|
@@ -97,11 +89,9 @@ def safe_get_blob_properties(): | |||||||
| ''' | ||||||||
| nonlocal blob_exists | ||||||||
| if not blob_exists: | ||||||||
| blob_exists = blob_service.exists( | ||||||||
| container_name=container_name, blob_name=blob_name) | ||||||||
| blob_exists = blob_service.exists() | ||||||||
| if blob_exists: | ||||||||
| return blob_service.get_blob_properties( | ||||||||
| container_name=container_name, blob_name=blob_name) | ||||||||
| return blob_service.get_blob_properties() | ||||||||
| return None | ||||||||
|
|
||||||||
| # Try to get the initial properties so there's no waiting. | ||||||||
|
|
@@ -110,7 +100,7 @@ def safe_get_blob_properties(): | |||||||
| props = safe_get_blob_properties() | ||||||||
| if props: | ||||||||
| metadata = props.metadata | ||||||||
| available = props.properties.content_length | ||||||||
| available = props.size | ||||||||
| except (AttributeError, AzureHttpError): | ||||||||
| pass | ||||||||
|
|
||||||||
|
|
@@ -123,18 +113,13 @@ def safe_get_blob_properties(): | |||||||
|
|
||||||||
| try: | ||||||||
| old_byte_size = len(stream.getvalue()) | ||||||||
| blob_service.get_blob_to_stream( | ||||||||
| container_name=container_name, | ||||||||
| blob_name=blob_name, | ||||||||
| start_range=start, | ||||||||
| end_range=end, | ||||||||
| stream=stream) | ||||||||
| downloader = blob_service.download_blob(offset=start, length=byte_size, max_concurrency=1) | ||||||||
| downloader.readinto(stream) | ||||||||
|
Comment on lines
+116
to
+117
|
||||||||
| downloader = blob_service.download_blob(offset=start, length=byte_size, max_concurrency=1) | |
| downloader.readinto(stream) | |
| stream.write(downloader.readall()) |
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
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
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
Oops, something went wrong.
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.
The function signature has changed but the docstring and parameter documentation are missing. The removal of
container_nameandblob_nameparameters should be documented, and the newblob_serviceparameter (now a BlobClient) should be clearly documented.