From 6c767859019ec5cc6b74249ee6c2e3f155165ef5 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Sat, 27 Jan 2024 13:31:31 -0500 Subject: [PATCH] expose debugging flag to CLI (#17) * expose debugging flag to CLI * add bench flag too * propagate to asv run --- src/nwb_benchmarks/command_line_interface.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nwb_benchmarks/command_line_interface.py b/src/nwb_benchmarks/command_line_interface.py index d05de1c..a4877a4 100644 --- a/src/nwb_benchmarks/command_line_interface.py +++ b/src/nwb_benchmarks/command_line_interface.py @@ -12,6 +12,12 @@ def main(): return command = sys.argv[1] + flags_list = sys.argv[2:] + + debug_mode = "--debug" in flags_list + bench_mode = "--bench" in flags_list + if bench_mode: + specific_benchmark_pattern = flags_list[flags_list.index("--bench")+1] if command == "run": commit_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode("ascii").strip() @@ -24,6 +30,10 @@ def main(): "--set-commit-hash", commit_hash, ] + if debug_mode: + cmd.extend(["--verbose", "--show-std-err"]) + if bench_mode: + cmd.extend(["--bench", specific_benchmark_pattern]) process = subprocess.Popen(cmd, stdout=subprocess.PIPE) # , bufsize=1) encoding = locale.getpreferredencoding() # This is how ASV chooses to encode the output