Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round before formatting #181

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions src/con_duct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading