def test_futures_to_dask_bag(loop): import dask.bag as db with cluster() as (c, [a, b]): with Executor(('127.0.0.1', c['port']), loop=loop) as e: data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] futures = e.scatter(data) b = futures_to_dask_bag(futures) assert isinstance(b, db.Bag) assert b.map(lambda x: x + 1).sum().compute(get=e.get) == sum(range(2, 11))
def test_futures_to_dask_bag(loop): import dask.bag as db with cluster() as (s, [a, b]): with Client(s['address'], loop=loop) as c: data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] futures = c.scatter(data) b = futures_to_dask_bag(futures) assert isinstance(b, db.Bag) assert b.map(lambda x: x + 1).sum().compute(get=c.get) == sum(range(2, 11))
def test_futures_to_dask_bag(loop): import dask.bag as db with cluster() as (c, [a, b]): with Executor(('127.0.0.1', c['port']), loop=loop) as e: data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] futures = e.scatter(data) b = futures_to_dask_bag(futures) assert isinstance(b, db.Bag) assert b.map(lambda x: x + 1).sum().compute(get=e.get) == sum( range(2, 11))
def test_futures_to_dask_bag(loop): import dask.bag as db with cluster() as (c, [a, b]): with Client(("127.0.0.1", c["port"]), loop=loop) as c: data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] futures = c.scatter(data) b = futures_to_dask_bag(futures) assert isinstance(b, db.Bag) assert b.map(lambda x: x + 1).sum().compute(get=c.get) == sum(range(2, 11))