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

Fix glitches in Fine Performance Metrics stacked graph #7919

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 3 deletions distributed/dashboard/components/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,6 @@ def _build_task_execution_by_prefix_data(
_build_task_execution_by_prefix_chart
_update_task_execution_by_prefix_chart
"""
ymax = 0.0
func_totals = [
sum(data[function, activity] for activity in self.visible_activities)
for function in self.visible_functions
Expand All @@ -3732,8 +3731,7 @@ def _build_task_execution_by_prefix_data(
self._format(v) + f" ({v * perc_ki:.0f}%)"
for v, perc_ki in zip(values, perc_k)
]
ymax = max(ymax, sum(values))
return out, ymax
return out, max(func_totals, default=0.0)

def _build_task_execution_by_prefix_chart(self) -> figure:
"""Create empty stacked bar chart for execute by function
Expand Down
5 changes: 4 additions & 1 deletion distributed/dashboard/tests/test_scheduler_bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ async def test_WorkersMemory(c, s, a, b):
async def test_FinePerformanceMetrics(c, s, a, b):
cl = FinePerformanceMetrics(s)

# Test with no metrics
cl.update()
assert not cl.visible_functions

# execute on default span; multiple tasks in same TaskGroup
x0 = c.submit(inc, 0, key="x-0", workers=[a.address])
x1 = c.submit(inc, 1, key="x-1", workers=[a.address])
Expand Down Expand Up @@ -378,7 +382,6 @@ def f():
await a.heartbeat()
await b.heartbeat()

assert not cl.visible_functions
cl.update()
assert sorted(cl.visible_functions) == ["v", "w", "x", "y", "z"]
assert sorted(cl.unit_selector.options) == ["bytes", "count", "custom", "seconds"]
Expand Down