From 9e707b897df403248d5e2fc9c29a43902c2e4f34 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Wed, 20 Jul 2011 10:36:56 -0700 Subject: [PATCH] Remove the concept of batches from readwrite test. That's an internal implementation detail caused by the generate_objects api. --- s3tests/rand_readwrite.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/s3tests/rand_readwrite.py b/s3tests/rand_readwrite.py index be612a4..16fc35e 100644 --- a/s3tests/rand_readwrite.py +++ b/s3tests/rand_readwrite.py @@ -41,22 +41,22 @@ def reader(bucket, name, queue): if count == 0: gevent.sleep(1) -def writer(bucket, name, queue, quantity=1, file_size=1, file_stddev=0, file_name_seed=None): +def writer(bucket, name, queue, file_size=1, file_stddev=0, file_name_seed=None): + r = random.randint(0, 65535) + r2 = r + if file_name_seed != None: + r2 = file_name_seed + + files = realistic.files( + mean=1024 * file_size, + stddev=1024 * file_stddev, + seed=r, + ) + while True: - r = random.randint(0, 65535) - r2 = r - if file_name_seed != None: - r2 = file_name_seed - - files = generate_objects.get_random_files( - quantity=quantity, - mean=1024 * file_size, - stddev=1024 * file_stddev, - seed=r, - ) - + fp = next(files) start = time.time() - generate_objects.upload_objects(bucket, files, r2) + generate_objects.upload_objects(bucket, [fp], r2) end = time.time() elapsed = end - start @@ -82,8 +82,6 @@ def parse_options(): help="number of writer threads", default=2, metavar="NUM") parser.add_option("-s", "--size", dest="file_size", type="float", help="file size to use, in kb", default=1024, metavar="KB") - parser.add_option("-q", "--quantity", dest="quantity", type="int", - help="number of files per batch", default=1, metavar="NUM") parser.add_option("-d", "--stddev", dest="stddev", type="float", help="stddev of file size", default=0, metavar="KB") parser.add_option("-W", "--rewrite", dest="rewrite", action="store_true", @@ -117,7 +115,6 @@ def main(): queue=q, file_size=options.file_size, file_stddev=options.stddev, - quantity=options.quantity, file_name_seed=r, ) for x in xrange(options.num_readers):