You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DBOS Transact is a Python library providing**ultra-lightweight durable execution**.
11
+
DBOS Transact is a Python library for**ultra-lightweight durable execution**.
12
12
For example:
13
13
14
14
```python
@@ -28,18 +28,23 @@ def workflow()
28
28
29
29
Durable execution means your program is **resilient to any failure**.
30
30
If it is ever interrupted or crashes, all your workflows will automatically resume from the last completed step.
31
-
If you want to see durable execution in action, check out [this demo app](https://demo-widget-store.cloud.dbos.dev/) (source code [here](https://github.com/dbos-inc/dbos-demo-apps/tree/main/python/widget-store)).
32
-
No matter how many times you try to crash it, it always resumes from exactly where it left off!
31
+
Durable execution helps solve many common problems:
33
32
34
-
Under the hood, DBOS Transact works by storing your program's execution state (which workflows are currently executing and which steps they've completed) in a Postgres database.
35
-
So all you need to use it is a Postgres database to connect to—there's no need for a "workflow server."
36
-
This approach is also incredibly fast, for example [25x faster than AWS Step Functions](https://www.dbos.dev/blog/dbos-vs-aws-step-functions-benchmark).
33
+
- Orchestrating long-running or business-critical workflows so they seamlessly recover from any failure.
34
+
- Running reliable background jobs with no timeouts.
35
+
- Processing incoming events (e.g. from Kafka) exactly once.
36
+
- Running a fault-tolerant distributed task queue.
37
+
- Running a reliable cron scheduler.
38
+
- Operating an AI agent, or anything that connects to an unreliable or non-deterministic API.
37
39
38
-
Some more cool features include:
40
+
What’s unique about DBOS's implementation of durable execution is that it’s implemented in a **lightweight library** that’s **totally backed by Postgres**.
41
+
To use DBOS, just `pip install` it and annotate your program with DBOS decorators.
42
+
Under the hood, those decorators store your program's execution state (which workflows are currently executing and which steps they've completed) in a Postgres database.
43
+
If your program crashes or is interrupted, they automatically recover its workflows from their stored state.
44
+
So all you need to use DBOS is Postgres—there are no other dependencies you have to manage, no separate workflow server.
39
45
40
-
- Scheduled jobs—run your workflows exactly-once per time interval.
41
-
- Exactly-once event processing—use workflows to process incoming events (for example, from a Kafka topic) exactly-once.
One big advantage of this approach is that you can add DBOS to **any** Python application—**it’s just a library**.
47
+
You can use DBOS to add reliable background jobs or cron scheduling or queues to your app with no external dependencies except Postgres.
43
48
44
49
## Getting Started
45
50
@@ -50,7 +55,7 @@ pip install dbos
50
55
dbos init --config
51
56
```
52
57
53
-
Then, try it out with this simple program (requires Postgres):
58
+
Then, try it out with this simple program:
54
59
55
60
```python
56
61
from fastapi import FastAPI
@@ -80,14 +85,14 @@ def fastapi_endpoint():
80
85
dbos_workflow()
81
86
```
82
87
83
-
Save the program into `main.py`, edit `dbos-config.yaml` to configure your Postgres connection settings, and start it with `fastapi run`.
88
+
Save the program into `main.py` and start it with `fastapi run`.
84
89
Visit `localhost:8000` in your browser to start the workflow.
85
90
When prompted, press `Control + \` to force quit your application.
86
91
It should crash midway through the workflow, having completed step one but not step two.
87
92
Then, restart your app with `fastapi run`.
88
93
It should resume the workflow from where it left off, completing step two without re-executing step one.
89
94
90
-
To learn how to build more complex workflows, see our[programming guide](https://docs.dbos.dev/python/programming-guide) or [examples](https://docs.dbos.dev/examples).
95
+
To learn how to build more complex workflows, see the[programming guide](https://docs.dbos.dev/python/programming-guide) or [examples](https://docs.dbos.dev/examples).
91
96
92
97
## Documentation
93
98
@@ -98,7 +103,7 @@ To learn how to build more complex workflows, see our [programming guide](https:
98
103
99
104
-[**AI-Powered Slackbot**](https://docs.dbos.dev/python/examples/rag-slackbot)— A Slackbot that answers questions about previous Slack conversations, using DBOS to durably orchestrate its RAG pipeline.
100
105
-[**Widget Store**](https://docs.dbos.dev/python/examples/widget-store)— An online storefront that uses DBOS durable workflows to be resilient to any failure.
101
-
-[**Earthquake Tracker**](https://docs.dbos.dev/python/examples/earthquake-tracker)—A real-time earthquake dashboard that uses DBOS to stream data from the USGS into Postgres, then visualizes it with Streamlit.
106
+
-[**Scheduled Reminders**](https://docs.dbos.dev/python/examples/scheduled-reminders)—In just three lines of code, schedule an email to send days, weeks, or months in the future.
102
107
103
108
More examples [here](https://docs.dbos.dev/examples)!
0 commit comments