From 3c4f196d1e60694748b46adc91813b0836daa39b Mon Sep 17 00:00:00 2001 From: dingbo Date: Thu, 14 Jul 2022 15:14:31 +0800 Subject: [PATCH] docs: mockdatasoruce.py --- docs/examples/python/highvolume_faster_queue.py | 2 ++ docs/examples/python/mockdatasoruce.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/examples/python/highvolume_faster_queue.py b/docs/examples/python/highvolume_faster_queue.py index ebd4115e21..ccdde705a4 100644 --- a/docs/examples/python/highvolume_faster_queue.py +++ b/docs/examples/python/highvolume_faster_queue.py @@ -139,12 +139,14 @@ def main(): for i in range(WRITE_TASK_COUNT): queue = Queue(max_size_bytes=QUEUE_SIZE) task_queues.append(queue) + # create write processes for i in range(WRITE_TASK_COUNT): p = Process(target=run_write_task, args=(i, task_queues[i])) p.start() logging.debug(f"WriteTask-{i} started with pid {p.pid}") write_processes.append(p) + # create read processes for i in range(READ_TASK_COUNT): p = Process(target=run_read_task, args=(i, task_queues)) diff --git a/docs/examples/python/mockdatasoruce.py b/docs/examples/python/mockdatasoruce.py index cf4d8db98a..d07128a38a 100644 --- a/docs/examples/python/mockdatasoruce.py +++ b/docs/examples/python/mockdatasoruce.py @@ -3,11 +3,11 @@ import time class MockDataSource: samples = [ - "LosAngeles,0,8.8,119,0.32", - "SanDiego,1,10.7,116,0.34", - "Hollywood,2,9.9,111,0.33", - "Compton,3,8.9,113,0.329", - "San Francisco,4,9.4,118,0.141" + "8.8,119,0.32,LosAngeles,0", + "10.7,116,0.34,SanDiego,1", + "9.9,111,0.33,Hollywood,2", + "8.9,113,0.329,Compton,3", + "9.4,118,0.141,San Francisco,4" ] def __init__(self, tb_name_prefix, table_count): @@ -22,7 +22,7 @@ class MockDataSource: data = [] for i in range(self.table_count): 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] data.append((i, row)) # tableId, row return data -- GitLab