Skip to content

Commit bf94b1c

Browse files
Update README
1 parent 7411ddf commit bf94b1c

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"unpackb",
108108
"upgrader",
109109
"uvcli",
110+
"uvicorn",
110111
"varsser",
111112
"venv",
112113
"vmihailenco",

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,13 @@ This project is still being worked on and is not ready for public release.
7676
sleep(1.0)
7777
count = count + 1
7878

79-
def create_app() -> FastAPI:
80-
# connect to postgres and start deepslate
81-
platform, _ = new_postgres(1, DBURL, "localhost:8765", 100, 100, 5)
82-
spawn_fn, _, _, _ = spawn_workers(4, platform, [counter()])
83-
spawn_inspector(platform, "localhost:8080")
8479

80+
def create_app(spawn_fn, get_fn, trace_fn, shutdown_fn) -> FastAPI:
8581
app = FastAPI()
8682
app.state.spawn = spawn_fn
83+
app.state.get = get_fn
84+
app.state.trace = trace_fn
85+
app.state.shutdown = shutdown_fn
8786

8887
# spawn a new durable counter flow with the given name
8988
@app.post("/counter/{name}")
@@ -94,10 +93,14 @@ This project is still being worked on and is not ready for public release.
9493
return app
9594

9695

97-
app = create_app()
98-
99-
10096
if __name__ == "__main__":
97+
# connect to postgres and start deepslate
98+
platform, _ = new_postgres(1, DBURL, "localhost:8765", 100, 100, 5)
99+
spawn_fn, get_fn, trace_fn, shutdown_fn = spawn_workers(4, platform, [counter()])
100+
spawn_inspector(platform, "localhost:8080")
101+
102+
# start the server
103+
app = create_app(spawn_fn, get_fn, trace_fn, shutdown_fn)
101104
uvicorn.run(app, host="0.0.0.0", port=8000, workers=1)
102105
```
103106

0 commit comments

Comments
 (0)