20 lines
698 B
Python
20 lines
698 B
Python
import aiosched
|
|
from raw_catch import child_raises
|
|
|
|
|
|
async def main(children: list[tuple[str, int]]):
|
|
try:
|
|
async with aiosched.with_context() as ctx:
|
|
print("[main] Spawning children")
|
|
for name, delay in children:
|
|
await ctx.spawn(child_raises, name, delay)
|
|
print("[main] Children spawned")
|
|
before = aiosched.clock()
|
|
except BaseException as err:
|
|
print(f"[main] Child raised an exception -> {type(err).__name__}: {err}")
|
|
print(f"[main] Children exited in {aiosched.clock() - before:.2f} seconds")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
aiosched.run(main, [("first", 1), ("second", 2), ("third", 3)], debugger=None)
|