Skip to content

Commit

Permalink
Fix stealing dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Jun 21, 2021
1 parent c8ed3f6 commit f42faec
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions distributed/dashboard/components/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,15 +1144,18 @@ class StealingTimeSeries(DashboardComponent):
def __init__(self, scheduler, **kwargs):
self.scheduler = scheduler
self.source = ColumnDataSource(
{"time": [time(), time() + 1], "idle": [0, 0.1], "saturated": [0, 0.1]}
{
"time": [time() * 1000, time() * 1000 + 1],
"idle": [0, 0],
"saturated": [0, 0],
}
)

x_range = DataRange1d(follow="end", follow_interval=20000, range_padding=0)

self.root = figure(
title="Idle and Saturated Workers Over Time",
x_axis_type="datetime",
y_range=[-0.1, len(scheduler.workers) + 0.1],
height=150,
tools="",
x_range=x_range,
Expand Down Expand Up @@ -1204,7 +1207,6 @@ def __init__(self, scheduler, **kwargs):
self.root = figure(
title="Stealing Events",
x_axis_type="datetime",
y_axis_type="log",
height=250,
tools="",
x_range=x_range,
Expand All @@ -1214,12 +1216,12 @@ def __init__(self, scheduler, **kwargs):
self.root.circle(
source=self.source,
x="time",
y="cost_factor",
y="level",
color="color",
size="radius",
alpha=0.5,
)
self.root.yaxis.axis_label = "Cost Multiplier"
self.root.yaxis.axis_label = "Level"

hover = HoverTool()
hover.tooltips = "Level: @level, Duration: @duration, Count: @count, Cost factor: @cost_factor"
Expand Down Expand Up @@ -1262,9 +1264,11 @@ def convert(self, msgs):
def update(self):
with log_errors():
log = self.scheduler.get_events(topic="stealing")
n = self.steal.count - self.last
current = len(self.scheduler.events["stealing"])
n = current - self.last

log = [log[-i][1] for i in range(1, n + 1) if isinstance(log[-i][1], list)]
self.last = self.steal.count
self.last = current

if log:
new = pipe(
Expand Down

0 comments on commit f42faec

Please sign in to comment.