Skip to content

Commit 1eb3458

Browse files
authored
Merge pull request #125 from stealthrocket/readme-updates
Update README
2 parents adaa1d3 + 0000bb9 commit 1eb3458

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

README.md

+39-32
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@ Python package to develop applications with the Dispatch platform.
1515
[fastapi]: https://fastapi.tiangolo.com/tutorial/first-steps/
1616
[ngrok]: https://ngrok.com/
1717
[pypi]: https://pypi.org/project/dispatch-py/
18-
[signup]: https://docs.dispatch.run/stateful-functions/getting-started
18+
[signup]: https://console.dispatch.run/
1919

2020
- [What is Dispatch?](#what-is-dispatch)
2121
- [Installation](#installation)
2222
- [Usage](#usage)
2323
- [Configuration](#configuration)
2424
- [Integration with FastAPI](#integration-with-fastapi)
2525
- [Local testing with ngrok](#local-testing-with-ngrok)
26-
- [Durable coroutines for Python](#durable-coroutines-for-python)
26+
- [Distributed coroutines for Python](#distributed-coroutines-for-python)
2727
- [Examples](#examples)
2828
- [Contributing](#contributing)
2929

3030
## What is Dispatch?
3131

32-
Dispatch is a platform for developing reliable distributed systems. Dispatch
33-
provides a simple programming model based on durable coroutines to manage the
34-
scheduling of function calls across a fleet of service instances. Orchestration
35-
of function calls is managed by Dispatch, providing **fair scheduling**,
36-
transparent **retry of failed operations**, and **durability**.
32+
Dispatch is a platform for developing scalable & reliable distributed systems.
33+
34+
Dispatch provides a simple programming model based on *Distributed Coroutines*,
35+
allowing complex, dynamic workflows to be expressed with regular code and
36+
control flow.
37+
38+
Dispatch schedules function calls across a fleet of service instances,
39+
incorporating **fair scheduling**, transparent **retry of failed operations**,
40+
and **durability**.
3741

3842
To get started, follow the instructions to [sign up for Dispatch][signup] 🚀.
3943

@@ -46,32 +50,34 @@ pip install dispatch-py
4650

4751
## Usage
4852

49-
The SDK allows Python applications to declare *Stateful Functions* that the
50-
Dispatch scheduler can orchestrate. This is the bare minimum structure used
51-
to declare stateful functions:
53+
The SDK allows Python applications to declare functions that Dispatch can
54+
orchestrate:
55+
5256
```python
5357
@dispatch.function
5458
def action(msg):
5559
...
5660
```
61+
5762
The **@dispatch.function** decorator declares a function that can be run by
58-
the Dispatch scheduler. The call has durable execution semantics; if the
59-
function fails with a temporary error, it is automatically retried, even if
60-
the program is restarted, or if multiple instances are deployed.
63+
Dispatch. The call has durable execution semantics; if the function fails
64+
with a temporary error, it is automatically retried, even if the program is
65+
restarted, or if multiple instances are deployed.
66+
67+
The SDK adds a method to the `action` object, allowing the program to
68+
dispatch an asynchronous invocation of the function; for example:
6169

62-
In this example, the decorator adds a method to the `action` object, allowing
63-
the program to dispatch an asynchronous invocation of the function; for example:
6470
```python
6571
action.dispatch('hello')
6672
```
6773

6874
### Configuration
6975

70-
To interact with stateful functions, the SDK needs to be configured with the
71-
address at which the server can be reached. The Dispatch API Key must also be
72-
set, and optionally, a public signing key should be configured to verify that
73-
requests received by the stateful functions originated from the Dispatch
74-
scheduler. These configuration options can be passed as arguments to the
76+
In order for Dispatch to interact with functions remotely, the SDK needs to be
77+
configured with the address at which the server can be reached. The Dispatch
78+
API Key must also be set, and optionally, a public signing key should be
79+
configured to verify that requests originated from Dispatch. These
80+
configuration options can be passed as arguments to the
7581
the `Dispatch` constructor, but by default they will be loaded from environment
7682
variables:
7783

@@ -82,7 +88,7 @@ variables:
8288
| `DISPATCH_VERIFICATION_KEY` | `-----BEGIN PUBLIC KEY-----...` |
8389

8490
Finally, the `Dispatch` instance needs to mount a route on a HTTP server in to
85-
receive requests from the scheduler. At this time, the SDK integrates with
91+
receive requests from Dispatch. At this time, the SDK integrates with
8692
FastAPI; adapters for other popular Python frameworks will be added in the
8793
future.
8894

@@ -111,12 +117,11 @@ def root():
111117
```
112118

113119
In this example, GET requests on the HTTP server dispatch calls to the
114-
`publish` stateful function. The function runs concurrently to the rest of the
115-
program, driven by the Dispatch scheduler.
120+
`publish` function. The function runs concurrently to the rest of the
121+
program, driven by the Dispatch SDK.
116122

117123
The instantiation of the `Dispatch` object on the `FastAPI` application
118-
automatically installs the HTTP route needed for the scheduler to run stateful
119-
functions.
124+
automatically installs the HTTP route needed for Dispatch to invoke functions.
120125

121126
### Local testing with ngrok
122127

@@ -149,13 +154,13 @@ different value, but in this example it would be:
149154
export DISPATCH_ENDPOINT_URL="https://f441-2600-1700-2802-e01f-6861-dbc9-d551-ecfb.ngrok-free.app"
150155
```
151156

152-
### Durable coroutines for Python
157+
### Distributed Coroutines for Python
153158

154159
The `@dispatch.function` decorator can also be applied to Python coroutines
155-
(a.k.a. *async* functions), in which case each await point on another
156-
stateful function becomes a durability step in the execution: if the awaited
157-
operation fails, it is automatically retried and the parent function is paused
158-
until the result becomes available, or a permanent error is raised.
160+
(a.k.a. *async* functions), in which case each `await` point becomes a
161+
durability step in the execution. If the awaited operation fails, it is
162+
automatically retried, and the parent function is paused until the result are
163+
available or a permanent error is raised.
159164

160165
```python
161166
@dispatch.function
@@ -185,8 +190,7 @@ async def transform2(msg):
185190
```
186191

187192
This model is composable and can be used to create fan-out/fan-in control flows.
188-
`gather` can be used to wait on multiple concurrent calls to stateful functions,
189-
for example:
193+
`gather` can be used to wait on multiple concurrent calls:
190194

191195
```python
192196
from dispatch import gather
@@ -201,6 +205,9 @@ async def transform(msg):
201205
...
202206
```
203207

208+
Dispatch converts Python coroutines to *Distributed Coroutines*, which can be
209+
suspended and resumed on any instance of a service across a fleet.
210+
204211
### Serialization
205212

206213
Dispatch uses the [pickle] library to serialize coroutines.

0 commit comments

Comments
 (0)