from __future__ import print_function, division, absolute_import from bisect import bisect from toolz import valmap from bokeh.plotting import curdoc, vplot from distributed.bokeh.status_monitor import (task_stream_plot, progress_plot) from distributed.utils import log_errors import distributed.bokeh messages = distributed.bokeh.messages # global message store doc = curdoc() width = 800 task_stream_source, task_stream_plot = task_stream_plot(height=600, width=width, follow_interval=20000) task_stream_plot.min_border_top = 0 task_stream_plot.min_border_bottom = 0 task_stream_plot.min_border_left = 0 task_stream_plot.min_border_right = 10 task_stream_plot.xaxis.axis_label = None task_stream_index = [0] rectangles = messages['task-events']['rectangles'] rectangles = valmap(list, rectangles) task_stream_source.data.update(rectangles) doc.add_root(task_stream_plot)
from __future__ import print_function, division, absolute_import from bisect import bisect from toolz import valmap from bokeh.plotting import curdoc, vplot from distributed.bokeh.status_monitor import (task_stream_plot, progress_plot) from distributed.utils import log_errors import distributed.bokeh messages = distributed.bokeh.messages # global message store doc = curdoc() width = 800 task_stream_source, task_stream_plot = task_stream_plot(height=800, width=width, follow_interval=20000) task_stream_plot.min_border_top = 0 task_stream_plot.min_border_bottom = 0 task_stream_plot.min_border_left = 0 task_stream_plot.min_border_right = 10 task_stream_plot.xaxis.axis_label = None task_stream_index = [0] rectangles = messages['task-events']['rectangles'] rectangles = valmap(list, rectangles) task_stream_source.data.update(rectangles) doc.add_root(task_stream_plot)
def test_task_stream_plot(): source, plot = task_stream_plot()
d = progress_quads(msg) progress_source.data.update(d) progress_plot.title.text = ("Progress -- total: %(total)s, " "in-memory: %(in-memory)s, processing: %(processing)s, " "ready: %(ready)s, waiting: %(waiting)s, failed: %(failed)s" % messages['tasks']['deque'][-1]) nb = nbytes_bar(msg['nbytes']) nbytes_task_source.data.update(nb) nbytes_task_plot.title.text = \ "Memory Use: %0.2f MB" % (sum(msg['nbytes'].values()) / 1e6) doc.add_periodic_callback(progress_update, 50) task_stream_index = [0] task_stream_source, task_stream_plot = task_stream_plot( sizing_mode=SIZING_MODE, width=WIDTH, height=300) def task_stream_update(): with log_errors(): index = messages['task-events']['index'] old = rectangles = messages['task-events']['rectangles'] if not index or index[-1] == task_stream_index[0]: return ind = bisect(index, task_stream_index[0]) rectangles = {k: [v[i] for i in range(ind, len(index))] for k, v in rectangles.items()} task_stream_index[0] = index[-1] # If there has been a five second delay, clear old rectangles if rectangles['start']:
progress_plot.logo = None # progress_plot.toolbar_location = None progress_plot.xaxis.axis_label = None def progress_update(): with log_errors(): msg = messages['progress'] d = progress_quads(msg) progress_source.data.update(d) doc.add_periodic_callback(progress_update, 50) task_stream_source, task_stream_plot = task_stream_plot(height=int(width / 2), width=width, follow_interval=None) task_stream_plot.min_border_bottom = 0 task_stream_plot.min_border_left = 0 task_stream_plot.min_border_right = 10 task_stream_plot.xaxis.axis_label = None task_stream_index = [0] def task_stream_update(): with log_errors(): index = messages['task-events']['index'] old = rectangles = messages['task-events']['rectangles'] if not index or index[-1] == task_stream_index[0]: return
progress_plot.min_border_bottom -= 40 progress_plot.plot_height -= 80 progress_plot.logo = None # progress_plot.toolbar_location = None progress_plot.xaxis.axis_label = None def progress_update(): with log_errors(): msg = messages['progress'] d = progress_quads(msg) progress_source.data.update(d) doc.add_periodic_callback(progress_update, 50) task_stream_source, task_stream_plot = task_stream_plot(height=int(width/2), width=width, follow_interval=None) task_stream_plot.min_border_bottom = 0 task_stream_plot.min_border_left = 0 task_stream_plot.min_border_right = 10 task_stream_plot.xaxis.axis_label = None task_stream_index = [0] def task_stream_update(): with log_errors(): index = messages['task-events']['index'] old = rectangles = messages['task-events']['rectangles'] if not index or index[-1] == task_stream_index[0]: return ind = bisect(index, task_stream_index[0]) rectangles = {k: [v[i] for i in range(ind, len(index))]
progress_source, progress_plot = progress_plot() def progress_update(): with log_errors(): msg = messages['progress'] d = progress_quads(msg) progress_source.data.update(d) progress_plot.title.text = ("Progress -- total: %(total)s, " "in-memory: %(in-memory)s, processing: %(processing)s, " "ready: %(ready)s, waiting: %(waiting)s, failed: %(failed)s" % messages['tasks']['deque'][-1]) doc.add_periodic_callback(progress_update, 50) task_stream_index = [0] task_stream_source, task_stream_plot = task_stream_plot() def task_stream_update(): with log_errors(): index = messages['task-events']['index'] old = rectangles = messages['task-events']['rectangles'] if not index or index[-1] == task_stream_index[0]: return ind = bisect(index, task_stream_index[0]) rectangles = {k: [v[i] for i in range(ind, len(index))] for k, v in rectangles.items()} task_stream_index[0] = index[-1] # If there has been a five second delay, clear old rectangles if rectangles['start']:
#!/usr/bin/env python from __future__ import print_function, division, absolute_import from toolz import valmap from bokeh.io import curdoc from distributed.bokeh.status_monitor import task_stream_plot import distributed.bokeh messages = distributed.bokeh.messages # global message store doc = curdoc() task_stream_source, task_stream_plot = task_stream_plot( sizing_mode='stretch_both') task_stream_index = [0] rectangles = messages['task-events']['rectangles'] rectangles = valmap(list, rectangles) task_stream_source.data.update(rectangles) doc.add_root(task_stream_plot)
#!/usr/bin/env python from __future__ import print_function, division, absolute_import from toolz import valmap from bokeh.io import curdoc from distributed.bokeh.status_monitor import task_stream_plot import distributed.bokeh messages = distributed.bokeh.messages # global message store doc = curdoc() task_stream_source, task_stream_plot = task_stream_plot(sizing_mode='stretch_both') task_stream_index = [0] rectangles = messages['task-events']['rectangles'] rectangles = valmap(list, rectangles) task_stream_source.data.update(rectangles) doc.add_root(task_stream_plot)