From ea4c6ee7b38f3d68008b056c32d8589680ca534e Mon Sep 17 00:00:00 2001 From: Greg Foss Date: Wed, 11 Mar 2020 15:18:41 -0400 Subject: [PATCH] Adding command infrastructure to python run script --- .../breadcrumbs/algos/AlgoBreadcrumbs.cpp | 1 - bfs/scripts/log.txt | 21 +++++++++++++++++++ bfs/scripts/startbfs.py | 11 ++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/bfs/implementations/breadcrumbs/algos/AlgoBreadcrumbs.cpp b/bfs/implementations/breadcrumbs/algos/AlgoBreadcrumbs.cpp index 9215193..7bdba8f 100644 --- a/bfs/implementations/breadcrumbs/algos/AlgoBreadcrumbs.cpp +++ b/bfs/implementations/breadcrumbs/algos/AlgoBreadcrumbs.cpp @@ -4,7 +4,6 @@ void AlgoBreadcrumbs::loop() { - printf("Hello world!\n"); vector* attribs = pollForAttributes(); if (attribs->size() > 0) { diff --git a/bfs/scripts/log.txt b/bfs/scripts/log.txt index 7782617..f4c958c 100644 --- a/bfs/scripts/log.txt +++ b/bfs/scripts/log.txt @@ -38,3 +38,24 @@ Listening for clients... Listening for clients... Hello new client! Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Could not acquire mutex to add new client thread +Listening for clients... +Hello new client! +Listening for clients... +Could not acquire mutex to add new client thread +Listening for clients... +Hello new client! +Listening for clients... +Could not acquire mutex to add new client thread +Listening for clients... +Hello new client! +Listening for clients... diff --git a/bfs/scripts/startbfs.py b/bfs/scripts/startbfs.py index b114c36..427cec5 100644 --- a/bfs/scripts/startbfs.py +++ b/bfs/scripts/startbfs.py @@ -74,6 +74,17 @@ def main(): exe_ending = ".exe" exe_names = get_exe_names(args.algorithm, args.io_processor, args.config) procs = [start_program_async(os.path.join(binary_path, x) + exe_ending) for x in exe_names] + + try: + while True: + user_in = input() + if user_in == "q": + print("Quitting prompt") + [proc.terminate() for proc in procs] + break + except Exception as e: + print("Python exception: [%s]" % str(e)) + [proc.join() for proc in procs] print("DONE")