koder aka kdanilov | 3cbbc9d | 2015-02-04 15:37:58 +0200 | [diff] [blame^] | 1 | import sys |
| 2 | import uuid |
| 3 | import random |
| 4 | import itertools |
| 5 | |
| 6 | from petname import Generate as pet_generate |
| 7 | from storage_api import create_storage |
| 8 | |
| 9 | |
| 10 | types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(10)] |
| 11 | random.shuffle(types) |
| 12 | tp = itertools.cycle(types) |
| 13 | |
| 14 | sz = ["4k", "64k", "1m"] |
| 15 | op_type = ["randread", "read", "randwrite", "write"] |
| 16 | is_sync = ["s", "a"] |
| 17 | |
| 18 | storage = create_storage(sys.argv[1]) |
| 19 | |
| 20 | for i in range(30): |
| 21 | row = {"build_id": pet_generate(2, " "), |
| 22 | "type": next(tp), |
| 23 | "iso_md5": uuid.uuid4().get_hex()} |
| 24 | |
| 25 | for sz, op_type, is_sync in itertools.product(op_type, is_sync, sz): |
| 26 | row[" ".join([sz, op_type, is_sync])] = (random.random(), |
| 27 | random.random() / 5) |
| 28 | |
| 29 | storage.store(row) |