From b9a236a36a041f86c659cc6d0e56b8ab47291819 Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Thu, 25 Aug 2022 10:33:21 +0200 Subject: [PATCH] Startup --- script/test/test_thread.py | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 script/test/test_thread.py diff --git a/script/test/test_thread.py b/script/test/test_thread.py new file mode 100644 index 0000000..dd079f7 --- /dev/null +++ b/script/test/test_thread.py @@ -0,0 +1,49 @@ + + +statistics=Namespace() +pipeline_config = PipelineConfig("test_pipeline", parameters={"camera_name": "simulation", "function":"transparent"}) + + +def run_pipeline(port, pipeline_config, parameter_queue, stop_event): + print ("Startint pipeline on port: ", port) + try: + processing_pipeline(stop_event, statistics, parameter_queue, camera_client, pipeline_config, port, MockBackgroundManager()) + except: + traceback.print_exc() + + +def get_data(port): + with source(host="127.0.0.1", port=port, mode=SUB, receive_timeout = 3000) as stream: + data = stream.receive() + if not data: + raise Exception("Received None message.") + print (data.data.data.keys()) + + +OUTPUT_PORT = 12005 +stop_event = threading.Event() +parameter_queue = queue.Queue() +thread = Thread(target=run_pipeline, args=(OUTPUT_PORT,pipeline_config, parameter_queue, stop_event)) +thread.start() +get_data(OUTPUT_PORT) +stop_event.set() +thread.join(5.0) +print ("Done") + + + + +OUTPUT_PORT = 12006 +stop_event = threading.Event() +parameter_queue = queue.Queue() +thread = Thread(target=run_pipeline, args=(OUTPUT_PORT,pipeline_config, parameter_queue, stop_event)) +thread.start() +get_data(OUTPUT_PORT) +stop_event.set() +thread.join(5.0) +print ("Done") + + + + +