From d5ce1b557e7d6feacc593c99b9ebdf069e3cf995 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Thu, 22 Aug 2019 16:56:58 -0600 Subject: [PATCH] Made thread logs prettier --- openfpga_flow/scripts/run_fpga_task.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/openfpga_flow/scripts/run_fpga_task.py b/openfpga_flow/scripts/run_fpga_task.py index f5fd08b0e..b445c9d7e 100644 --- a/openfpga_flow/scripts/run_fpga_task.py +++ b/openfpga_flow/scripts/run_fpga_task.py @@ -88,6 +88,7 @@ def validate_command_line_arguments(): if args.debug: logger.info("Setting loggger in debug mode") logger.setLevel(logging.DEBUG) + logger.info("Set up to run %d Parallel threads", args.maxthreads) def generate_each_task_actions(taskname): @@ -239,6 +240,16 @@ def create_run_command(curr_job_dir, archfile, benchmark_obj, task_conf): return command +def strip_child_logger_info(line): + try: + logtype, message = line.split(" - ", 1) + lognumb = {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, + "INFO": 20, "DEBUG": 10, "NOTSET": 0} + logger.log(lognumb["INFO"], message) + except: + logger.info(line) + + def run_single_script(s, eachJob): logger.debug('Added job in pool') with s: @@ -257,7 +268,7 @@ def run_single_script(s, eachJob): universal_newlines=True) for line in process.stdout: if not args.skip_tread_logs: - logging.info(line[:-1]) + strip_child_logger_info(line[:-1]) sys.stdout.buffer.flush() output.write(line) process.wait()