Script execution

This commit is contained in:
2022-08-26 09:38:52 +02:00
parent 8ed29d166c
commit 3ec8303dd2

View File

@@ -106,4 +106,46 @@ def dont_exit(status):
print ("System Exit status: ", status)
sys.exit = dont_exit
DEFAULT_PIPELINE_PORT = 5005
stop_event = None
parameter_queue = None
statistics =None
current_pipeline = None
def start_pipeline(name, pars, port=DEFAULT_PIPELINE_PORT):
global stop_event, parameter_queue, statistics
if name is None:
raise Exception("Pipeline name undefined")
stop_pipeline();
current_pipeline = name
stop_event = threading.Event()
parameter_queue = queue.Queue()
statistics = Namespace()
def send(port):
print ("Startint pipeline ", name, " on port: ", port)
try:
processing_pipeline(stop_event, statistics, parameter_queue, camera_client, pipeline_config, port, MockBackgroundManager())
except:
traceback.print_exc()
thread = Thread(target=send, args=(port,))
thread.start()
def stop_pipeline():
global stop_event, parameter_queue, statistics
if get_pipeline():
try:
stop_event.set()
thread.join(5.0)
except:
traceback.print_exc()
current_pipeline = None
stop_event = None
parameter_queue = None
statistics =None
def get_pipeline():
return current_pipeline