Exemplo n.º 1
0
def test_client_sync(client):
    with get_task_stream(client=client) as ts:
        sleep(0.1)  # to smooth over time differences on the scheduler
        # to smooth over time differences on the scheduler
        futures = client.map(inc, range(10))
        wait(futures)

    assert len(ts.data) == 10
def test_client_sync(client):
    with get_task_stream(client=client) as ts:
        sleep(0.1)  # to smooth over time differences on the scheduler
        # to smooth over time differences on the scheduler
        futures = client.map(inc, range(10))
        wait(futures)

    assert len(ts.data) == 10
Exemplo n.º 3
0
def test_client_sync(loop):
    with cluster() as (s, [a, b]):
        with Client(s['address'], loop=loop) as c:
            with get_task_stream(client=c) as ts:
                sleep(0.1)  # to smooth over time differences on the scheduler
                # to smooth over time differences on the scheduler
                futures = c.map(inc, range(10))
                wait(futures)

            assert len(ts.data) == 10
Exemplo n.º 4
0
def maybe_setup_profile(profile, benchmark, protocol):
    if profile:
        name = f'{benchmark}-{protocol}.html'
        ctx = get_task_stream(
            plot='save',
            filename=name,
        )
    else:
        ctx = contextlib.nullcontext()

    return ctx
def test_get_task_stream_save(client, tmpdir):
    bokeh = pytest.importorskip("bokeh")
    tmpdir = str(tmpdir)
    fn = os.path.join(tmpdir, "foo.html")

    with get_task_stream(plot="save", filename=fn) as ts:
        wait(client.map(inc, range(10)))
    with open(fn) as f:
        data = f.read()
    assert "inc" in data
    assert "bokeh" in data

    assert isinstance(ts.figure, bokeh.plotting.Figure)
Exemplo n.º 6
0
def test_get_task_stream_save(client, tmpdir):
    bokeh = pytest.importorskip('bokeh')
    tmpdir = str(tmpdir)
    fn = os.path.join(tmpdir, 'foo.html')

    with get_task_stream(plot='save', filename=fn) as ts:
        wait(client.map(inc, range(10)))
    with open(fn) as f:
        data = f.read()
    assert 'inc' in data
    assert 'bokeh' in data

    assert isinstance(ts.figure, bokeh.plotting.Figure)
Exemplo n.º 7
0
def test_get_task_stream_save(loop, tmpdir):
    bokeh = pytest.importorskip('bokeh')
    tmpdir = str(tmpdir)
    fn = os.path.join(tmpdir, 'foo.html')
    with cluster() as (s, [a, b]):
        with Client(s['address'], loop=loop) as c:
            with get_task_stream(plot='save', filename=fn) as ts:
                wait(c.map(inc, range(10)))
            with open(fn) as f:
                data = f.read()
            assert 'inc' in data
            assert 'bokeh' in data

            assert isinstance(ts.figure, bokeh.plotting.Figure)