示例#1
0
def test_processing_update():
    from distributed.diagnostics.scheduler import processing
    from distributed.bokeh.components import Processing

    class C(object):
        pass

    s = C()
    s.processing = {'alice': {'inc', 'add'}, 'bob': {'inc'}}
    s.waiting = {'x': set()}
    s.who_has = {'z': set()}
    s.ncores = {'alice': 4, 'bob': 4}

    msg = processing(s)

    assert msg == {'processing': {'alice': 2, 'bob': 1},
                   'waiting': 1,
                   'memory': 1,
                   'ncores': {'alice': 4, 'bob': 4}}

    data = Processing.processing_update(msg)
    expected = {'name': ['alice', 'bob'],
                'processing': [2, 1],
                'right': [2, 1],
                'top': [2, 1],
                'bottom': [1, 0],
                'ncores': [4, 4],
                'alpha': [0.7, 0.7]}

    assert data == expected
示例#2
0
def test_processing_update():
    from distributed.diagnostics.scheduler import processing
    from distributed.bokeh.components import Processing

    class C(object):
        pass

    s = C()
    s.processing = {'alice': {'inc', 'add'}, 'bob': {'inc'}}
    s.waiting = {'x': set()}
    s.who_has = {'z': set()}
    s.ncores = {'alice': 4, 'bob': 4}

    msg = processing(s)

    assert msg == {'processing': {'alice': 2, 'bob': 1},
                   'waiting': 1,
                   'memory': 1,
                   'ncores': {'alice': 4, 'bob': 4}}

    data = Processing.processing_update(msg)
    expected = {'name': ['alice', 'bob'],
                'processing': [2, 1],
                'right': [2, 1],
                'top': [2, 1],
                'bottom': [1, 0],
                'ncores': [4, 4],
                'alpha': [0.7, 0.7]}

    assert data == expected
示例#3
0
#!/usr/bin/env python

from __future__ import print_function, division, absolute_import

from bokeh.io import curdoc
from bokeh.layouts import column, row

import distributed.bokeh

from distributed.bokeh.components import Processing, WorkerTable

SIZING_MODE = 'scale_width'
WIDTH = 600

messages = distributed.bokeh.messages  # global message store
doc = curdoc()

processing = Processing(sizing_mode=SIZING_MODE, width=WIDTH, height=150)
doc.add_periodic_callback(lambda: processing.update(messages), 200)

worker_table = WorkerTable(sizing_mode=SIZING_MODE,
                           width=WIDTH,
                           plot_height=80)
doc.add_periodic_callback(lambda: worker_table.update(messages),
                          messages['workers']['interval'])

layout = column(row(processing.root, sizing_mode=SIZING_MODE),
                row(worker_table.root, sizing_mode=SIZING_MODE),
                sizing_mode=SIZING_MODE)
doc.add_root(layout)
示例#4
0
文件: main.py 项目: dask/distributed
#!/usr/bin/env python

from __future__ import print_function, division, absolute_import

from bokeh.io import curdoc
from bokeh.layouts import column, row

import distributed.bokeh

from distributed.bokeh.components import Processing, WorkerTable

SIZING_MODE = 'scale_width'
WIDTH = 600

messages = distributed.bokeh.messages  # global message store
doc = curdoc()

processing = Processing(sizing_mode=SIZING_MODE, width=WIDTH, height=150)
doc.add_periodic_callback(lambda: processing.update(messages), 200)

worker_table = WorkerTable(sizing_mode=SIZING_MODE, width=WIDTH, plot_height=80)
doc.add_periodic_callback(lambda: worker_table.update(messages), messages['workers']['interval'])

layout = column(
    row(processing.root, sizing_mode=SIZING_MODE),
    row(worker_table.root, sizing_mode=SIZING_MODE),
    sizing_mode=SIZING_MODE
)
doc.add_root(layout)