Exemplo n.º 1
0
def test_gather_scatter(loop):
    with cluster_center() as (c, [a, b]):
        data = {'x': 1, 'y': 2, 'z': 3}
        addr = '127.0.0.1:%d' % c['port']
        rds = scatter(addr, data)
        assert set(rds) == {'x', 'y', 'z'}

        names = sorted(rds)
        data2 = gather(addr, rds)
        data2 = dict(zip(rds, data2))
        assert data == data2

        delete(addr, ['x'])
        with pytest.raises(KeyError):
            gather(addr, ['x'])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ['y'])
Exemplo n.º 2
0
def test_gather_scatter():
    with cluster() as (c, [a, b]):
        data = {'x': 1, 'y': 2, 'z': 3}
        addr = '127.0.0.1', c['port']
        rds = scatter(addr, data)
        assert all(isinstance(rd, RemoteData) for rd in rds)
        assert {rd.key for rd in rds} == set(data)

        data2 = gather(addr, rds)
        data2 = dict(zip([rd.key for rd in rds], data2))
        assert data == data2

        delete(addr, ['x'])
        with pytest.raises(KeyError):
            gather(addr, ['x'])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ['y'])
Exemplo n.º 3
0
def test_gather_scatter(loop):
    with cluster_center() as (c, [a, b]):
        data = {'x': 1, 'y': 2, 'z': 3}
        addr = '127.0.0.1', c['port']
        rds = scatter(addr, data)
        assert set(rds) == {'x', 'y', 'z'}

        names = sorted(rds)
        data2 = gather(addr, rds)
        data2 = dict(zip(rds, data2))
        assert data == data2

        delete(addr, ['x'])
        with pytest.raises(KeyError):
            gather(addr, ['x'])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ['y'])
Exemplo n.º 4
0
def test_gather_scatter(loop):
    with cluster_center() as (c, [a, b]):
        data = {'x': 1, 'y': 2, 'z': 3}
        addr = '127.0.0.1', c['port']
        rds = scatter(addr, data)
        assert all(isinstance(rd, RemoteData) for rd in rds.values())
        assert set(rds) == set(data)
        assert all(k == v.key for k, v in rds.items())

        names = sorted(rds)
        data2 = gather(addr, [rds[name] for name in names])
        data2 = dict(zip(names, data2))
        assert data == data2

        delete(addr, ['x'])
        with pytest.raises(KeyError):
            gather(addr, ['x'])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ['y'])
Exemplo n.º 5
0
def test_gather_scatter(loop):
    with cluster_center() as (c, [a, b]):
        data = {'x': 1, 'y': 2, 'z': 3}
        addr = '127.0.0.1', c['port']
        rds = scatter(addr, data)
        assert all(isinstance(rd, RemoteData) for rd in rds.values())
        assert set(rds) == set(data)
        assert all(k == v.key for k, v in rds.items())

        names = sorted(rds)
        data2 = gather(addr, [rds[name] for name in names])
        data2 = dict(zip(names, data2))
        assert data == data2

        delete(addr, ['x'])
        with pytest.raises(KeyError):
            gather(addr, ['x'])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ['y'])
Exemplo n.º 6
0
def test_gather_scatter(loop):
    with cluster() as (c, [a, b]):
        data = {"x": 1, "y": 2, "z": 3}
        addr = "127.0.0.1", c["port"]
        rds = scatter(addr, data)
        assert all(isinstance(rd, RemoteData) for rd in rds.values())
        assert set(rds) == set(data)
        assert all(k == v.key for k, v in rds.items())

        names = sorted(rds)
        data2 = gather(addr, [rds[name] for name in names])
        data2 = dict(zip(names, data2))
        assert data == data2

        delete(addr, ["x"])
        with pytest.raises(KeyError):
            gather(addr, ["x"])
        clear(addr)
        with pytest.raises(KeyError):
            gather(addr, ["y"])