Forever repeat of an eventloop after each loop completion, in python 3.4
Question: I am using python 3.4. I'm trying to have a loop of several tasks running
asynchronously and when one circle of loop was complete then again loop starts
from beginning. It is necessary to start the loop again only after the last
round was complete. I thought this code might be what I'm looking for but it
only runs once.

    
    
    import asyncio
    
    @asyncio.coroutine
    def some_task(name, number):
        print('task ', name, ' started')
        yield from asyncio.sleep(number)
        print('task ', name, ' finished')
    
    @asyncio.coroutine
    def loop_executer(loop, tasks):
        if not loop.is_running():
            loop.run_until_complete(asyncio.wait(tasks))
    
    tasks = [
        asyncio.ensure_future(some_task("A", 2)),
        asyncio.ensure_future(some_task("B", 5)),
        asyncio.ensure_future(some_task("C", 4))]
    
    ev_loop = asyncio.get_event_loop()
    ev_loop.create_task(loop_executer(ev_loop, tasks))
    ev_loop.run_forever()
    


Answer: There is no mechanism to repeat tasks - wrap it `while` loop.

    
    
    import asyncio
    
    @asyncio.coroutine
    def some_task(name, number):
        print('task ', name, ' started')
        yield from asyncio.sleep(number)
        print('task ', name, ' finished')
    
    @asyncio.coroutine
    def loop_executer(loop):
        # you could use even while True here
        while loop.is_running():
            tasks = [
                some_task("A", 2),
                some_task("B", 5),
                some_task("C", 4)
            ]
            yield from asyncio.wait(tasks)
    
    ev_loop = asyncio.get_event_loop()
    ev_loop.create_task(loop_executer(ev_loop))
    ev_loop.run_forever()
    

You don't have to use `ensure_future` on coroutines.

