summaryrefslogtreecommitdiff
path: root/scripts/scalability/test_controller/server/blobs.py
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-10-31 16:32:45 -0200
committerdrebs <drebs@riseup.net>2017-11-02 09:36:31 -0200
commit31bdbc7268ff118080ecfb67f716fd86d3421032 (patch)
treef5229cd7a868c00a55d7440a88f604a5ec97596f /scripts/scalability/test_controller/server/blobs.py
parenta7f93cec7999de04614d7adaf91c4348a3313e2e (diff)
[benchmarks] use only one user in scalability tests
Diffstat (limited to 'scripts/scalability/test_controller/server/blobs.py')
-rw-r--r--scripts/scalability/test_controller/server/blobs.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/scalability/test_controller/server/blobs.py b/scripts/scalability/test_controller/server/blobs.py
index 2a60018d..2e68a12e 100644
--- a/scripts/scalability/test_controller/server/blobs.py
+++ b/scripts/scalability/test_controller/server/blobs.py
@@ -2,24 +2,28 @@
import shutil
import os
-
from argparse import ArgumentParser
-
+from twisted.logger import Logger
from test_controller.utils import mkdir_p, payload
+logger = Logger()
+
def _create_blob(path, data):
- if not os.path.isfile(path):
- with open(path, 'w') as f:
- f.write(data)
+ with open(path, 'w') as f:
+ logger.info('Creating %s' % path)
+ f.write(data)
def create_blobs(target_dir, amount, size):
+ delete_blobs(target_dir)
data = payload(size * 1000)
for i in xrange(amount):
- basedir = os.path.join(target_dir, '%d/default/0/0/0' % i)
+ istr = str(i)
+ blob_dir = '%s/%s/%s' % (istr[0], istr[0:3], istr[0:6])
+ basedir = os.path.join(target_dir, '0/default/%s' % blob_dir)
mkdir_p(basedir)
- _create_blob(os.path.join(basedir, '0'), data)
+ _create_blob(os.path.join(basedir, str(i)), data)
def delete_blobs(target_dir):
@@ -28,6 +32,7 @@ def delete_blobs(target_dir):
for f in os.listdir(target_dir):
if f.isdigit():
directory = os.path.join(target_dir, f)
+ logger.info('Deleting %s' % directory)
shutil.rmtree(directory)