Home / Companies / DBOS / Blog / Post Details
Content Deep Dive

Async Python is Secretly Deterministic

Blog post from DBOS

Post Details
Company
Date Published
Author
Peter Kraft Qian Li
Word Count
755
Company Posts That Month
12
Language
English
Hacker News Points
79
Post removed?
No
Summary

Adding asynchronous support to a Python durable execution library requires preserving deterministic step ordering so workflows can be replayed reliably after failures, even when multiple I/O-bound tasks run concurrently through functions such as `asyncio.gather`. Python’s single-threaded asyncio event loop executes one task at a time and only switches tasks when the current one explicitly yields through an `await`, while newly created tasks are initially scheduled in FIFO order. Although subsequent task interleaving and completion order may vary, their deterministic startup order can be used to assign stable workflow step identifiers before each step reaches its first await. By having the `@Step()` decorator increment and assign an ID immediately upon task execution, the system can consistently associate concurrent tasks with the same ordered steps during recovery, combining concurrency with replay-safe durability.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.