Procházet zdrojové kódy

修正负载生成

master
李云帆 před 3 roky
rodič
revize
c8489fbc90
1 změnil soubory, kde provedl 4 přidání a 5 odebrání
  1. +4
    -5
      fe/bench/workload.py

+ 4
- 5
fe/bench/workload.py Zobrazit soubor

@ -33,7 +33,7 @@ class Payment:
class Workload:
def __init__(self):
self.uuid = str(uuid.uuid1())
self.book_ids = []
self.book_ids = {}
self.buyer_ids = []
self.store_ids = []
self.book_db = book.BookDB(conf.Use_Large_DB)
@ -92,8 +92,7 @@ class Workload:
for bk in books:
code = seller.add_book(store_id, self.stock_level, bk)
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)
logging.info("seller data loaded.")
for k in range(1, self.buyer_num + 1):
@ -112,8 +111,8 @@ class Workload:
book_id_and_count = []
book_temp = []
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:
continue
else:

Načítá se…
Zrušit
Uložit