From fb07b77c84fa03b22cc4ae144cce4e7ab7c3db50 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Thu, 19 Sep 2024 19:32:40 -0500 Subject: [PATCH 1/2] Round before formatting If we don't do the rounding prior to formatting, the summary_format (being a format string, not an f-string) is not smart enough to handle floats OR None (or str 'unknown'). So instead we need to handle that first. Fixes: https://github.com/con/duct/issues/172 Fixes: https://github.com/con/duct/issues/171 --- src/con_duct/__main__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/con_duct/__main__.py b/src/con_duct/__main__.py index cc4f6f97..f290c347 100644 --- a/src/con_duct/__main__.py +++ b/src/con_duct/__main__.py @@ -33,7 +33,7 @@ "Exit Code: {exit_code}\n" "Command: {command}\n" "Log files location: {logs_prefix}\n" - "Wall Clock Time: {wall_clock_time:.3f} sec\n" + "Wall Clock Time: {wall_clock_time} sec\n" "Memory Peak Usage (RSS): {peak_rss} bytes\n" "Memory Average Usage (RSS): {average_rss} bytes\n" "Virtual Memory Peak Usage (VSZ): {peak_vsz} bytes\n" @@ -494,10 +494,18 @@ def dump_json(self) -> str: @property def execution_summary_formatted(self) -> str: - human_readable = { + unknowned = { k: "unknown" if v is None else v for k, v in self.execution_summary.items() } - return self.summary_format.format_map(human_readable) + + rounded = {} + for k, v in unknowned.items(): + if isinstance(v, float): + rounded[k] = round(v, 2) + else: + rounded[k] = v + + return self.summary_format.format_map(rounded) @dataclass From b79229a4fe51cebd130f505569cb595d7c2b32e7 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Fri, 20 Sep 2024 07:58:39 -0500 Subject: [PATCH 2/2] [DATALAD RUNCMD] Autoupdate readme === Do not change lines below === { "chain": [], "cmd": "./.update-readme-help.py", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 709b2318..0fd54706 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ options: Output template to use when printing the summary following execution. (default: Exit Code: {exit_code} Command: {command} Log files location: {logs_prefix} - Wall Clock Time: {wall_clock_time:.3f} sec Memory Peak + Wall Clock Time: {wall_clock_time} sec Memory Peak Usage (RSS): {peak_rss} bytes Memory Average Usage (RSS): {average_rss} bytes Virtual Memory Peak Usage (VSZ): {peak_vsz} bytes Virtual Memory Average Usage