def test__as_completed(c, s, a, b): x = c.submit(inc, 1) y = c.submit(inc, 1) z = c.submit(inc, 2) queue = Queue() yield _as_completed([x, y, z], queue) assert queue.qsize() == 3 assert {queue.get(), queue.get(), queue.get()} == {x, y, z} result = yield _first_completed([x, y, z]) assert result in [x, y, z]
def f(c, a, b): e = Executor((c.ip, c.port), start=False) IOLoop.current().spawn_callback(e._go) a = e.submit(inc, 1) b = e.submit(inc, 1) c = e.submit(inc, 2) from distributed.compatibility import Queue queue = Queue() yield _as_completed([a, b, c], queue) assert queue.qsize() == 3 assert {queue.get(), queue.get(), queue.get()} == {a, b, c} yield e._shutdown()
def f(c, a, b): e = Executor((c.ip, c.port), start=False, loop=loop) yield e._start() a = e.submit(inc, 1) b = e.submit(inc, 1) c = e.submit(inc, 2) from distributed.compatibility import Queue queue = Queue() yield _as_completed([a, b, c], queue) assert queue.qsize() == 3 assert {queue.get(), queue.get(), queue.get()} == {a, b, c} yield e._shutdown()
def test__as_completed(s, a, b): e = Executor((s.ip, s.port), start=False) yield e._start() a = e.submit(inc, 1) b = e.submit(inc, 1) c = e.submit(inc, 2) from distributed.compatibility import Queue queue = Queue() yield _as_completed([a, b, c], queue) assert queue.qsize() == 3 assert {queue.get(), queue.get(), queue.get()} == {a, b, c} yield e._shutdown()