diff --git a/bfs/include/DataSyncThread.hpp b/bfs/include/DataSyncThread.hpp index 09a3ceb..616f9f3 100644 --- a/bfs/include/DataSyncThread.hpp +++ b/bfs/include/DataSyncThread.hpp @@ -69,7 +69,6 @@ class DataSyncThread void startComms(); bool isRunning(); bool stopComms(); - bool isClientConnected() { return continueThread; }; unsigned int getSocketNumber() { return (unsigned int) socket; }; bool areIncomingAttributesAvailable(); vector getIncomingAttributes(); diff --git a/bfs/scripts/log.txt b/bfs/scripts/log.txt index 408b766..dabaeed 100644 --- a/bfs/scripts/log.txt +++ b/bfs/scripts/log.txt @@ -335,3 +335,42 @@ Hello new client! Listening for clients... Hello new client! Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +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... +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... diff --git a/bfs/scripts/startbfs.py b/bfs/scripts/startbfs.py index c44aea0..fbbf56f 100644 --- a/bfs/scripts/startbfs.py +++ b/bfs/scripts/startbfs.py @@ -9,21 +9,25 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) -def start_program(program): +def start_program(program, pause=True): if not isinstance(program, str): raise ValueError("Argument passed to start_program_sync() should be a string") - command = "START /wait \"\" CMD /c \"\"" + program + "\"&pause\"" + if pause: + command = "START /wait \"\" CMD /c \"\"" + program + "\"&pause\"" + else: + command = "START /wait \"\" CMD /c \"" + program + "\"" print("> " + command) return os.system(command) -def start_program_async(program): +def start_program_async(program, pause=True): # TODO: This needs to account for the number of cores... # Add another function called start_programs_async that takes a list # of programs and starts them on the proper cores. print("\n======> Starting ASYNC: %s <======" % program) - p = mp.Process(target=start_program, args=(program,)) + p = mp.Process(target=start_program, args=(program,pause)) p.start() + print(p.pid) return p @@ -66,6 +70,8 @@ def main(): will read and adjust their settings accordingly. That way, each process only has access to their own config settings. Note: this can be used in conjunction with -a and -p, but care is necessary to not produce any duplicate proceses.""") parser.add_argument("-b", "--build", help="If specified, run buildbfs.py before proceeding.", action="store_true") + parser.add_argument("-t", "--terminal", help="If specified, run a prompt while waiting for the processes to finish execution", action="store_true") + parser.add_argument("-s", "--stop", help="If specified, keep the cmd windows for the aglo and procs open with a 'pause' prompt after they are finished executing", action="store_true") args = parser.parse_args() if args.build: @@ -75,8 +81,17 @@ def main(): binary_path = os.path.abspath("..\\bin") 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] - + procs = [start_program_async(os.path.join(binary_path, x) + exe_ending, pause=args.stop) for x in exe_names] + + if args.console: + print("Press t to terminate or h for help.") + loop = True + while loop: + user_in = input() + if user_in == "t": + loop = False + + print("Waiting for cmd windows to close...") [proc.join() for proc in procs] print("DONE")