This repository has been archived on 2023-05-12. You can view files and clone it, but cannot push or open issues or pull requests.
aiosched/tests/context_timeout.py

17 lines
568 B
Python

import aiosched
from raw_wait import child
async def main(children: list[tuple[str, int]]):
print("[main] Spawning children")
async with aiosched.with_context(timeout=4, silent=True) as ctx:
for name, delay in children:
await ctx.spawn(child, name, delay)
print("[main] Children spawned")
before = aiosched.clock()
print(f"[main] Children exited in {aiosched.clock() - before:.2f} seconds")
if __name__ == "__main__":
aiosched.run(main, [("first", 2), ("second", 4), ("third", 6), ("fourth", 8)], debugger=None)