From a9cda2ad334e14795e4237e28bf6292eea160848 Mon Sep 17 00:00:00 2001 From: Karl W Schulz Date: Thu, 7 Mar 2024 14:52:28 -0600 Subject: [PATCH] add a exit keyword to console_error function; allows multiple error lines prior to code exit Signed-off-by: Karl W Schulz [ROCm/rocprofiler-compute commit: 2b24375e8d11e249cd68942b8a7b8b9c542a3046] --- projects/rocprofiler-compute/src/utils/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/rocprofiler-compute/src/utils/utils.py b/projects/rocprofiler-compute/src/utils/utils.py index 8ec78bddfb..f1e936b996 100644 --- a/projects/rocprofiler-compute/src/utils/utils.py +++ b/projects/rocprofiler-compute/src/utils/utils.py @@ -48,12 +48,13 @@ def demarcate(function): return wrap_function -def console_error(*argv): +def console_error(*argv,exit=True): if len(argv) > 1: logging.error("ERROR: " + f"[{argv[0]}] {argv[1]}") else: logging.error("ERROR: " + f"{argv[0]}") - sys.exit(1) + if exit: + sys.exit(1) def console_log(*argv,indent_level=0): @@ -258,7 +259,7 @@ def run_prof(fname, profiler_options, workload_dir, mspec, loglevel): if not success: if loglevel > logging.INFO: for line in output.splitlines(): - console_error(output) + console_error(output,exit=False) console_error("Profiling execution failed.") if new_env: