From 9dc741a1408b3ca7b2d6ca42a8b677d973245e3d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 3 Mar 2021 10:16:59 -0800 Subject: [PATCH] [Perf] Small fixes to storage-blob (#17055) - Removed unnecessary code in UploadTest (copied from DownloadTest) - Renamed option in ListBlobsTest to match other languages --- .../tests/perfstress_tests/_test_base.py | 2 +- .../tests/perfstress_tests/list_blobs.py | 4 ++-- .../azure-storage-blob/tests/perfstress_tests/upload.py | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sdk/storage/azure-storage-blob/tests/perfstress_tests/_test_base.py b/sdk/storage/azure-storage-blob/tests/perfstress_tests/_test_base.py index d508c349b1f7..678ea3986e27 100644 --- a/sdk/storage/azure-storage-blob/tests/perfstress_tests/_test_base.py +++ b/sdk/storage/azure-storage-blob/tests/perfstress_tests/_test_base.py @@ -40,7 +40,7 @@ def add_arguments(parser): parser.add_argument('--max-put-size', nargs='?', type=int, help='Maximum size of data uploading in single HTTP PUT. Defaults to 64*1024*1024', default=64*1024*1024) parser.add_argument('--max-block-size', nargs='?', type=int, help='Maximum size of data in a block within a blob. Defaults to 4*1024*1024', default=4*1024*1024) parser.add_argument('--buffer-threshold', nargs='?', type=int, help='Minimum block size to prevent full block buffering. Defaults to 4*1024*1024+1', default=4*1024*1024+1) - parser.add_argument('-c', '--max-concurrency', nargs='?', type=int, help='Maximum number of concurrent threads used for data transfer. Defaults to 1', default=1) + parser.add_argument('--max-concurrency', nargs='?', type=int, help='Maximum number of concurrent threads used for data transfer. Defaults to 1', default=1) parser.add_argument('-s', '--size', nargs='?', type=int, help='Size of data to transfer. Default is 10240.', default=10240) parser.add_argument('--no-client-share', action='store_true', help='Create one ServiceClient per test instance. Default is to share a single ServiceClient.', default=False) diff --git a/sdk/storage/azure-storage-blob/tests/perfstress_tests/list_blobs.py b/sdk/storage/azure-storage-blob/tests/perfstress_tests/list_blobs.py index ba858f2f532a..ce73c910cf2a 100644 --- a/sdk/storage/azure-storage-blob/tests/perfstress_tests/list_blobs.py +++ b/sdk/storage/azure-storage-blob/tests/perfstress_tests/list_blobs.py @@ -12,7 +12,7 @@ class ListBlobsTest(_ContainerTest): async def global_setup(self): await super().global_setup() - pending = (asyncio.ensure_future(self.async_container_client.upload_blob("listtest" + str(i), data=b"")) for i in range(self.args.num_blobs)) + pending = (asyncio.ensure_future(self.async_container_client.upload_blob("listtest" + str(i), data=b"")) for i in range(self.args.count)) running = list(itertools.islice(pending, 16)) while True: # Wait for some upload to finish before adding a new one @@ -36,4 +36,4 @@ async def run_async(self): @staticmethod def add_arguments(parser): super(ListBlobsTest, ListBlobsTest).add_arguments(parser) - parser.add_argument('--num-blobs', nargs='?', type=int, help='Number of blobs to list. Defaults to 100', default=100) + parser.add_argument('-c', '--count', nargs='?', type=int, help='Number of blobs to list. Defaults to 100', default=100) diff --git a/sdk/storage/azure-storage-blob/tests/perfstress_tests/upload.py b/sdk/storage/azure-storage-blob/tests/perfstress_tests/upload.py index ae54908475da..72b4926136da 100644 --- a/sdk/storage/azure-storage-blob/tests/perfstress_tests/upload.py +++ b/sdk/storage/azure-storage-blob/tests/perfstress_tests/upload.py @@ -12,17 +12,9 @@ class UploadTest(_BlobTest): def __init__(self, arguments): super().__init__(arguments) - blob_name = "downloadtest" - self.blob_client = self.container_client.get_blob_client(blob_name) - self.async_blob_client = self.async_container_client.get_blob_client(blob_name) self.upload_stream = RandomStream(self.args.size) self.upload_stream_async = AsyncRandomStream(self.args.size) - async def global_setup(self): - await super().global_setup() - data = get_random_bytes(self.args.size) - await self.async_blob_client.upload_blob(data) - def run_sync(self): self.upload_stream.reset() self.blob_client.upload_blob(