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

Handle zero mem available correctly in plot_metrics #391

Merged
merged 3 commits into from
Sep 15, 2023
Merged
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
4 changes: 2 additions & 2 deletions tibanna/cw_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def get_metrics(self, nTimeChunks=1):
max_disk_space_used_GB_chunks.append(self.max_disk_space_used())
max_ebs_read_chunks.append(self.max_ebs_read())
self.max_mem_used_MB = self.choose_max(max_mem_used_MB_chunks)
self.min_mem_available_MB = self.choose_min(min_mem_available_MB_chunks)
if self.max_mem_used_MB:
self.min_mem_available_MB = self.get_min(min_mem_available_MB_chunks)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am replacing choose_min with get_min here since we want to keep 0.0 in the list. This assumes that we never get None or "" items from CW, which is probably save to assume?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problematic case occurred for min_mem_available_MB_chunks = [0.0]. This should now be handled correctly.

if self.max_mem_used_MB and self.min_mem_available_MB!='':
self.total_mem_MB = self.max_mem_used_MB + self.min_mem_available_MB
self.max_mem_utilization_percent = self.max_mem_used_MB / self.total_mem_MB * 100
else:
Expand Down
Loading