def test_processing_plot(): from distributed.bokeh.worker_monitor import processing_plot source, fig = processing_plot()
def f(_, old, new): host = worker_source.data['host'] hosts = [host[i] for i in new['1d']['indices']] @gen.coroutine def _(): results = yield scheduler.broadcast(hosts=hosts, msg={'op': 'health'}) text = json.dumps(results, indent=2) paragraph.text = text doc.add_next_tick_callback(_) worker_source.on_change('selected', f) """ processing_source, processing_plot = processing_plot(width=WIDTH, height=150) def processing_plot_update(): with log_errors(): msg = messages['processing'] if not msg['ncores']: return data = processing_update(msg) x_range = processing_plot.x_range max_right = max(data['right']) min_left = min(data['left'][:-1]) cores = max(data['ncores']) if min_left < x_range.start: # not out there enough, jump ahead x_range.start = min_left - 2 elif x_range.start < 2 * min_left - cores: # way out there, walk back x_range.start = x_range.start * 0.95 + min_left * 0.05 if x_range.end < max_right: