async def test_many_Progress(c, s, a, b): x = c.submit(f, 1) y = c.submit(g, x) z = c.submit(h, y) bars = [Progress(keys=[z], scheduler=s) for _ in range(10)] await asyncio.gather(*(bar.setup() for bar in bars)) await z while not all(b.status == "finished" for b in bars): await asyncio.sleep(0.01)
def test_many_Progress(c, s, a, b): x = c.submit(f, 1) y = c.submit(g, x) z = c.submit(h, y) bars = [Progress(keys=[z], scheduler=s) for i in range(10)] yield [bar.setup() for bar in bars] yield z start = time() while not all(b.status == "finished" for b in bars): yield gen.sleep(0.1) assert time() < start + 5
def test_many_Progresss(s, a, b): sched, report = Queue(), Queue(); s.handle_queues(sched, report) s.update_graph(dsk={'x': (inc, 1), 'y': (inc, 'x'), 'z': (inc, 'y')}, keys=['z']) bars = [Progress(keys=['z'], scheduler=s) for i in range(10)] yield [b.setup() for b in bars] while True: msg = yield report.get() if msg['op'] == 'key-in-memory' and msg['key'] == 'z': break assert all(b.status == 'finished' for b in bars)
async def setup(scheduler): p = Progress(keys, scheduler, complete=complete) await p.setup() return p