async def waiter(): demo.LOG_TASK_START('waiter') try: await asyncio.sleep(60) except asyncio.CancelledError: demo.LOG('** CANCELLED **') raise demo.LOG_TASK_END()
async def test_timeout(): demo.LOG_TASK_START('test_timeout') await asyncio.get_event_loop().run_in_executor(None, time.sleep, 5) demo.LOG_TASK_END()
async def get_b(): demo.LOG_TASK_START('get_b') await asyncio.sleep(4) demo.LOG_TASK_END() return 2
async def get_a(): demo.LOG_TASK_START('get_a') await asyncio.sleep(2) demo.LOG_TASK_END() return 1
def get_a(): demo.LOG_TASK_START('get_a') yield from asyncio.sleep(2) demo.LOG_TASK_END() return 1
async def wait_task(ndx, timeout): demo.LOG_TASK_START('wait_task', ndx) await asyncio.get_event_loop().run_in_executor(None, time.sleep, timeout) demo.LOG_TASK_END() return ndx
async def wait_task(timeout, ndx): demo.LOG_TASK_START('wait_task', ndx) await asyncio.sleep(timeout) demo.LOG_TASK_END()
async def wait_task(timeout, ndx): demo.LOG_TASK_START(f'wait_task;timeout({timeout})', ndx) await asyncio.sleep(timeout) demo.LOG_TASK_END() return ndx