Exemplo n.º 1
0
def test_progressbar_widget(c, s, a, b):
    x = c.submit(inc, 1)
    y = c.submit(inc, x)
    z = c.submit(inc, y)
    yield wait(z)

    progress = ProgressWidget([z.key], scheduler=s.address, complete=True)
    yield progress.listen()

    assert progress.bar.value == 1.0
    assert '3 / 3' in progress.bar_text.value

    progress = ProgressWidget([z.key], scheduler=s.address)
    yield progress.listen()
Exemplo n.º 2
0
def test_progressbar_widget(s, a, b):
    s.update_graph(dsk={'x': (inc, 1),
                        'y': (inc, 'x'),
                        'z': (inc, 'y')},
                   keys=['z'])

    progress = ProgressWidget(['z'], scheduler=(s.ip, s.port))
    yield progress.listen()

    assert progress.bar.value == 1.0
    assert '3 / 3' in progress.bar_text.value

    progress = ProgressWidget(['z'], scheduler=(s.ip, s.port))
    yield progress.listen()
Exemplo n.º 3
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.º 4
0
def test_progressbar_widget(s, a, b):
    s.update_graph(tasks=valmap(dumps_task, {'x': (inc, 1),
                                             'y': (inc, 'x'),
                                             'z': (inc, 'y')}),
                   keys=['z'],
                   dependencies={'y': {'x'}, 'z': {'y'}})

    progress = ProgressWidget(['z'], scheduler=(s.ip, s.port))
    yield progress.listen()

    assert progress.bar.value == 1.0
    assert '3 / 3' in progress.bar_text.value

    progress = ProgressWidget(['z'], scheduler=(s.ip, s.port))
    yield progress.listen()
Exemplo n.º 5
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.º 6
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.º 7
0
    def f(c, a, b):
        s = Scheduler((c.ip, c.port), loop=loop)
        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.º 8
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.º 9
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.º 10
0
    def f():
        s = yield Scheduler(port=0)
        a, b = yield [
            Worker(s.address, nthreads=1),
            Worker(s.address, nthreads=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()