Example #1
0
async def test_asyncio_variable():
    async with AioClient(processes=False) as c:
        s = c.cluster.scheduler

        x = Variable("x")
        xx = Variable("x")
        assert x.client is c

        future = c.submit(inc, 1)

        await x.set(future)
        future2 = await xx.get()
        assert future.key == future2.key

        del future, future2

        await asyncio.sleep(0.1)
        assert s.tasks  # future still present

        x.delete()

        start = time()
        while s.tasks:
            await asyncio.sleep(0.01)
            assert time() < start + 5
Example #2
0
async def test_asyncio_variable():
    async with AioClient(processes=False) as c:
        s = c.cluster.scheduler

        x = Variable('x')
        xx = Variable('x')
        assert x.client is c

        future = c.submit(inc, 1)

        await x.set(future)
        future2 = await xx.get()
        assert future.key == future2.key

        del future, future2

        await asyncio.sleep(0.1)
        assert s.tasks  # future still present

        x.delete()

        start = time()
        while s.tasks:
            await asyncio.sleep(0.01)
            assert time() < start + 5