Skip to content

Instantly share code, notes, and snippets.

@zzstoatzz
Created May 27, 2025 23:03
Show Gist options
  • Select an option

  • Save zzstoatzz/72882c46a2a7d80ba8c4452aa9926651 to your computer and use it in GitHub Desktop.

Select an option

Save zzstoatzz/72882c46a2a7d80ba8c4452aa9926651 to your computer and use it in GitHub Desktop.
import asyncio
from prefect import flow, task
@task
async def sleepy_task() -> None:
await asyncio.sleep(15)
@flow(log_prints=True)
async def sleepy_flow() -> None:
tasks = [sleepy_task.submit() for _ in range(100)]
print("Waiting for all tasks to complete...")
results = [t.result() for t in tasks]
print(f"collected {len(results)} results")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment