This commit is contained in:
team3
2026-06-22 13:44:33 +02:00
parent 0adc223c0a
commit 613a4a2b1f
4 changed files with 51 additions and 30 deletions

View File

@@ -309,3 +309,20 @@ async def run_single_slot(
return OK, res[0]
async def _gather_fortschritt(coros, total, melde, start=0):
"""Läuft `coros` nebenläufig und meldet Live-Fortschritt: `await melde(fertig, total)`
nach jedem Abschluss (und einmal initial). Ergebnisse in Reihenfolge, return_exceptions=True."""
done = start
async def wrap(c):
nonlocal done
try:
return await c
finally:
done += 1
await melde(done, total)
await melde(done, total)
return await asyncio.gather(*[wrap(c) for c in coros], return_exceptions=True)