Exemplo n.º 1
0
    def f(c, a, b):
        s = Scheduler((c.ip, c.port), loop=loop)
        s.listen(0)
        yield s.sync_center()
        done = s.start()

        s.update_graph(dsk={'x': (div, 1, 0)}, keys=['x'])

        progress = TextProgressBar(['x'],
                                   scheduler=(s.ip, s.port),
                                   start=False,
                                   interval=0.01)
        yield progress.listen()

        assert progress.status == 'error'
        assert progress.stream.closed()

        progress = TextProgressBar(['x'],
                                   scheduler=(s.ip, s.port),
                                   start=False,
                                   interval=0.01)
        yield progress.listen()
        assert progress.status == 'error'
        assert progress.stream.closed()

        s.close()
        yield done
Exemplo n.º 2
0
def test_TextProgressBar_error(c, s, a, b):
    x = c.submit(div, 1, 0)

    progress = TextProgressBar([x.key], scheduler=(s.ip, s.port),
                               start=False, interval=0.01)
    yield progress.listen()

    assert progress.status == 'error'
    assert progress.stream.closed()

    progress = TextProgressBar([x.key], scheduler=(s.ip, s.port),
                               start=False, interval=0.01)
    yield progress.listen()
    assert progress.status == 'error'
    assert progress.stream.closed()
Exemplo n.º 3
0
def test_TextProgressBar_error(s, a, b):
    s.update_graph(tasks={'x': dumps_task((div, 1, 0))},
                   keys=['x'],
                   dependencies={})

    progress = TextProgressBar(['x'], scheduler=(s.ip, s.port),
                               start=False, interval=0.01)
    yield progress.listen()

    assert progress.status == 'error'
    assert progress.stream.closed()

    progress = TextProgressBar(['x'], scheduler=(s.ip, s.port),
                               start=False, interval=0.01)
    yield progress.listen()
    assert progress.status == 'error'
    assert progress.stream.closed()
Exemplo n.º 4
0
async def test_TextProgressBar_empty(s, a, b, capsys):
    progress = TextProgressBar([],
                               scheduler=s.address,
                               start=False,
                               interval=0.01)
    await progress.listen()

    assert progress.status == "finished"
    check_bar_completed(capsys)
async def test_TextProgressBar_error(c, s, a, b):
    x = c.submit(div, 1, 0)

    progress = TextProgressBar([x.key],
                               scheduler=s.address,
                               start=False,
                               interval=0.01)
    await progress.listen()

    assert progress.status == "error"
    assert progress.comm.closed()

    progress = TextProgressBar([x.key],
                               scheduler=s.address,
                               start=False,
                               interval=0.01)
    await progress.listen()
    assert progress.status == "error"
    assert progress.comm.closed()
async def test_TextProgressBar_empty(capsys):
    async with Scheduler(port=0) as s:
        async with Worker(s.address, nthreads=1) as a:
            async with Worker(s.address, nthreads=1) as b:
                progress = TextProgressBar([],
                                           scheduler=s.address,
                                           start=False,
                                           interval=0.01)
                await progress.listen()

                assert progress.status == "finished"
                check_bar_completed(capsys)
Exemplo n.º 7
0
    def f(c, a, b):
        s = Scheduler((c.ip, c.port), loop=loop)
        yield s.sync_center()
        done = s.start(0)

        progress = TextProgressBar([], scheduler=(s.ip, s.port), start=False,
                                   interval=0.01)
        yield progress.listen()

        assert progress.status == 'finished'
        check_bar_completed(capsys)

        s.close()
        yield done
Exemplo n.º 8
0
def test_text_progressbar(capsys, client):
    futures = client.map(inc, range(10))
    p = TextProgressBar(futures, interval=0.01, complete=True)
    client.gather(futures)

    start = time()
    while p.status != 'finished':
        sleep(0.01)
        assert time() - start < 5

    check_bar_completed(capsys)
    assert p._last_response == {'all': 10,
                                'remaining': 0,
                                'status': 'finished'}
    assert p.comm.closed()
Exemplo n.º 9
0
    def f():
        s = yield Scheduler(port=0)
        a, b = yield [Worker(s.address, ncores=1), Worker(s.address, ncores=1)]

        progress = TextProgressBar([],
                                   scheduler=s.address,
                                   start=False,
                                   interval=0.01)
        yield progress.listen()

        assert progress.status == "finished"
        check_bar_completed(capsys)

        yield [a.close(), b.close()]
        s.close()
        yield s.finished()
Exemplo n.º 10
0
    def f():
        s = Scheduler(loop=loop)
        done = s.start(0)
        a = Worker(s.ip, s.port, loop=loop, ncores=1)
        b = Worker(s.ip, s.port, loop=loop, ncores=1)
        yield [a._start(0), b._start(0)]

        progress = TextProgressBar([], scheduler=(s.ip, s.port), start=False,
                                   interval=0.01)
        yield progress.listen()

        assert progress.status == 'finished'
        check_bar_completed(capsys)

        yield [a._close(), b._close()]
        s.close()
        yield done
Exemplo n.º 11
0
def test_text_progressbar(capsys, loop):
    with cluster(nanny=True) as (s, [a, b]):
        with Client(('127.0.0.1', s['port']), loop=loop) as c:
            futures = c.map(inc, range(10))
            p = TextProgressBar(futures, interval=0.01, complete=True)
            c.gather(futures)

            start = time()
            while p.status != 'finished':
                sleep(0.01)
                assert time() - start < 5

            check_bar_completed(capsys)
            assert p._last_response == {'all': 10,
                                        'remaining': 0,
                                        'status': 'finished'}
            assert p.stream.closed()