|
@ -33,7 +33,7 @@ class Payment: |
|
|
class Workload: |
|
|
class Workload: |
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
self.uuid = str(uuid.uuid1()) |
|
|
self.uuid = str(uuid.uuid1()) |
|
|
self.book_ids = [] |
|
|
|
|
|
|
|
|
self.book_ids = {} |
|
|
self.buyer_ids = [] |
|
|
self.buyer_ids = [] |
|
|
self.store_ids = [] |
|
|
self.store_ids = [] |
|
|
self.book_db = book.BookDB(conf.Use_Large_DB) |
|
|
self.book_db = book.BookDB(conf.Use_Large_DB) |
|
@ -92,8 +92,7 @@ class Workload: |
|
|
for bk in books: |
|
|
for bk in books: |
|
|
code = seller.add_book(store_id, self.stock_level, bk) |
|
|
code = seller.add_book(store_id, self.stock_level, bk) |
|
|
assert code == 200 |
|
|
assert code == 200 |
|
|
if i == 1 and j == 1: |
|
|
|
|
|
self.book_ids.append(bk.id) |
|
|
|
|
|
|
|
|
self.book_ids[store_ids].append(bk.id) |
|
|
row_no = row_no + len(books) |
|
|
row_no = row_no + len(books) |
|
|
logging.info("seller data loaded.") |
|
|
logging.info("seller data loaded.") |
|
|
for k in range(1, self.buyer_num + 1): |
|
|
for k in range(1, self.buyer_num + 1): |
|
@ -112,8 +111,8 @@ class Workload: |
|
|
book_id_and_count = [] |
|
|
book_id_and_count = [] |
|
|
book_temp = [] |
|
|
book_temp = [] |
|
|
for i in range(0, books): |
|
|
for i in range(0, books): |
|
|
book_no = int(random.uniform(0, len(self.book_ids) - 1)) |
|
|
|
|
|
book_id = self.book_ids[book_no] |
|
|
|
|
|
|
|
|
book_no = int(random.uniform(0, len(self.book_ids[store_id]) - 1)) |
|
|
|
|
|
book_id = self.book_ids[store_id][book_no] |
|
|
if book_id in book_temp: |
|
|
if book_id in book_temp: |
|
|
continue |
|
|
continue |
|
|
else: |
|
|
else: |
|
|