From 14910fe0161124026e33c26887bd156f4fa7fbc1 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 6 Nov 2020 18:45:38 -0800 Subject: [PATCH] Config the default blocksize to 32k for Python 3.7+ (#14442) * customize httpadapter to honor kwargs in send method * update * update * update * update * update * update * update * FI from master (#14501) * [metricsadvisor] live tests setup (#14396) * add live test yml for metrics advisor * some fixes * hardcode test ids and rerecord a few tests * add ids back as env variables * [formrecognizer] initial business cards (#14026) * Sync eng/common directory with azure-sdk-tools for PR 1081 (#14445) Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/1081 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/master/eng/common/README.md#workflow) * Communication Administration: Add on-demand resource creation for live-tests (#14366) * Add communication service preparer * Refactor dynamic resource creation testing code * Remove setup method of base test class * Change fake conn str to valid format * Remove unused import * Remove main test file * Reduce RG expiry durtion * Async test code change with resource preparer * Add chaching for resource-preparer * Move helper into shared * Move preparer into shared * Uncomment test code * Remove CommunicationResourceGroupPreparer use common instead * Add base testcase for sync pnm * move phone_number_helper to phone_number folder * Add base pnm async testcase * Add __init__ for test folders * Fix identity tests to refer to shared test folder * Refactor base async phonenumber test class * Make decorator consisitent across all async tests utm * Replace fake resource value * Fix type in test file names * Remove commented cache setting code * Add livetest recording files * Refresh recording files * Update recording files * Reorganize the test folder structure * Add mgmt pacakge to the dev reqs Co-authored-by: tural farhadov * [ServiceBus] Small stress test and sample touchups (#14304) * Emplace sample generated for customer issue on the side for future reference. (generate sas token and authenticate) * Adjust stress test that was using push receive instead of pull. * Add async version of non-session to session send failure test, make both cached to improve perf. * Codegen for Azure Monitor (#14057) * Codegen fro Azure Monitor * codeowner * commit 2 * Update sdk/monitor/opentelemetry-exporter-azuremonitor/README.md * doc setings * Update eng/.docsettings.yml * Update eng/.docsettings.yml * Update sdk/monitor/opentelemetry-exporter-azuremonitor/README.md * Update eng/.docsettings.yml * version * oops * comments * Update sdk/monitor/opentelemetry-exporter-azuremonitor/LICENSE.txt Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> * [Storage][FileShare]Regenerate for delete leased snapshot (#14469) * add repr to models (#14475) * remove validations (#14476) * Ma remove readonly assignments (#14478) * Ensure azure-identity readme has exactly one H1 (#14480) The docs publishing system disallows multiple H1 headings in a document. * Sync eng/common directory with azure-sdk-tools for PR 1088 (#14482) * Add pipeline configuration for cleaning up upstream branches * Fix powershell naming * Switch to use github API * Use github API to delete branches Co-authored-by: Chidozie Ononiwu * enable live tests (#14467) * Removed asynctestcase.py (#14444) * testcase.py now uses AzureTestCase (#14443) Co-authored-by: Krista Pratico Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: turalf Co-authored-by: tural farhadov Co-authored-by: KieranBrantnerMagee Co-authored-by: Rakshith Bhyravabhotla Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Co-authored-by: Xiaoxi Fu <49707495+xiafu-msft@users.noreply.github.com> Co-authored-by: Charles Lowell Co-authored-by: Chidozie Ononiwu Co-authored-by: Bradley D'Amato <53579156+bradleydamato@users.noreply.github.com> * update * update * update * update * update * update * update * update Co-authored-by: Krista Pratico Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: turalf Co-authored-by: tural farhadov Co-authored-by: KieranBrantnerMagee Co-authored-by: Rakshith Bhyravabhotla Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Co-authored-by: Xiaoxi Fu <49707495+xiafu-msft@users.noreply.github.com> Co-authored-by: Charles Lowell Co-authored-by: Chidozie Ononiwu Co-authored-by: Bradley D'Amato <53579156+bradleydamato@users.noreply.github.com> --- .../_bigger_block_size_http_adapters.py | 45 +++++++++++++++++++ .../pipeline/transport/_requests_basic.py | 3 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 sdk/core/azure-core/azure/core/pipeline/transport/_bigger_block_size_http_adapters.py diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_bigger_block_size_http_adapters.py b/sdk/core/azure-core/azure/core/pipeline/transport/_bigger_block_size_http_adapters.py new file mode 100644 index 0000000..0bb8d9d --- /dev/null +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_bigger_block_size_http_adapters.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +import sys +from requests.adapters import HTTPAdapter + + +class BiggerBlockSizeHTTPAdapter(HTTPAdapter): + def get_connection(self, url, proxies=None): + """Returns a urllib3 connection for the given URL. This should not be + called from user code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param url: The URL to connect to. + :param proxies: (optional) A Requests-style dictionary of proxies used on this request. + :rtype: urllib3.ConnectionPool + """ + conn = super(BiggerBlockSizeHTTPAdapter, self).get_connection(url, proxies) + system_version = tuple(sys.version_info)[:3] + if system_version[:2] >= (3, 7): + conn.conn_kw = {"blocksize": 32768} + return conn diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py index ea0e7b0..987222e 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_basic.py @@ -43,6 +43,7 @@ HttpResponse, _HttpResponseBase ) +from ._bigger_block_size_http_adapters import BiggerBlockSizeHTTPAdapter PipelineType = TypeVar("PipelineType") @@ -213,7 +214,7 @@ def _init_session(self, session): """ session.trust_env = self._use_env_settings disable_retries = Retry(total=False, redirect=False, raise_on_status=False) - adapter = requests.adapters.HTTPAdapter(max_retries=disable_retries) + adapter = BiggerBlockSizeHTTPAdapter(max_retries=disable_retries) for p in self._protocols: session.mount(p, adapter)