提交 3c4f196d 编写于 作者: D dingbo

docs: mockdatasoruce.py

上级 ca9a65d7
...@@ -139,12 +139,14 @@ def main(): ...@@ -139,12 +139,14 @@ def main():
for i in range(WRITE_TASK_COUNT): for i in range(WRITE_TASK_COUNT):
queue = Queue(max_size_bytes=QUEUE_SIZE) queue = Queue(max_size_bytes=QUEUE_SIZE)
task_queues.append(queue) task_queues.append(queue)
# create write processes # create write processes
for i in range(WRITE_TASK_COUNT): for i in range(WRITE_TASK_COUNT):
p = Process(target=run_write_task, args=(i, task_queues[i])) p = Process(target=run_write_task, args=(i, task_queues[i]))
p.start() p.start()
logging.debug(f"WriteTask-{i} started with pid {p.pid}") logging.debug(f"WriteTask-{i} started with pid {p.pid}")
write_processes.append(p) write_processes.append(p)
# create read processes # create read processes
for i in range(READ_TASK_COUNT): for i in range(READ_TASK_COUNT):
p = Process(target=run_read_task, args=(i, task_queues)) p = Process(target=run_read_task, args=(i, task_queues))
......
...@@ -3,11 +3,11 @@ import time ...@@ -3,11 +3,11 @@ import time
class MockDataSource: class MockDataSource:
samples = [ samples = [
"LosAngeles,0,8.8,119,0.32", "8.8,119,0.32,LosAngeles,0",
"SanDiego,1,10.7,116,0.34", "10.7,116,0.34,SanDiego,1",
"Hollywood,2,9.9,111,0.33", "9.9,111,0.33,Hollywood,2",
"Compton,3,8.9,113,0.329", "8.9,113,0.329,Compton,3",
"San Francisco,4,9.4,118,0.141" "9.4,118,0.141,San Francisco,4"
] ]
def __init__(self, tb_name_prefix, table_count): def __init__(self, tb_name_prefix, table_count):
...@@ -22,7 +22,7 @@ class MockDataSource: ...@@ -22,7 +22,7 @@ class MockDataSource:
data = [] data = []
for i in range(self.table_count): for i in range(self.table_count):
table_name = self.table_name_prefix + str(i) table_name = self.table_name_prefix + str(i)
# tbName,location,groupId,current,voltage,phase # tbName,current,voltage,phase,location,groupId
row = table_name + ',' + lines[i] row = table_name + ',' + lines[i]
data.append((i, row)) # tableId, row data.append((i, row)) # tableId, row
return data return data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册