-
Notifications
You must be signed in to change notification settings - Fork 10
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
HTML repr for Maps #227
HTML repr for Maps #227
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.7.0 #227 +/- ##
=====================================
Coverage 84% 84%
=====================================
Files 77 78 +1
Lines 3795 3813 +18
Branches 391 393 +2
=====================================
+ Hits 3208 3226 +18
Misses 503 503
Partials 84 84
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some quibbles about the code itself, but the structure looks good.
htmap/maps.py
Outdated
sc = collections.Counter(self.component_statuses) | ||
row: Dict[str, Union[str, int, float]] = {"tag": self.tag} | ||
|
||
for status in state.ComponentStatus.display_statuses(): | ||
row[status.value.lower()] = sc[status] | ||
|
||
tag = row["tag"] | ||
held = row["held"] | ||
errored = row["errored"] | ||
idle = row["idle"] | ||
running = row["running"] | ||
completed = row["completed"] | ||
|
||
local_data = utils.num_bytes_to_str(self.local_data) | ||
max_memory = utils.num_bytes_to_str(max(self.memory_usage) * 1024 * 1024) | ||
max_runtime = str(max(self.runtime)) | ||
total_runtime = str(sum(self.runtime, datetime.timedelta())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The row
dictionary seems unhelpful here; just pull the data directly from self.component_statuses
(you can still use state.ComponentStatus.display_statuses()
to get the ones to show), and use self.tag
for the tag.
This is part of work on #53 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
maps could be displayed in HTML format