Skip to content

Commit

Permalink
unfederated execution for +1 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Depetrol committed Oct 10, 2024
1 parent c7ef7ee commit 0f9aa8c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ C/include
Cpp/**/include
Cpp/**/share
Cpp/**/lib
examples/Python/include
# Created by https://www.toptal.com/developers/gitignore/api/intellij,gradle,eclipse,maven,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,gradle,eclipse,maven,visualstudiocode

Expand Down
4 changes: 2 additions & 2 deletions examples/Python/src/WebServer/minimal.lf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target Python {
coordination: decentralized
keepalive: true
}

preamble {=
Expand Down Expand Up @@ -53,6 +53,6 @@ reactor WebServer(bank_index=0, STA=0) {
=}
}

federated reactor {
main reactor {
server = new WebServer()
}
4 changes: 2 additions & 2 deletions examples/Python/src/WebServer/minimal_with_lib.lf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target Python {
coordination: decentralized
keepalive: true
}

import WebServer from "../lib/WebServer.lf"
Expand All @@ -17,7 +17,7 @@ reactor Handler {
=}
}

federated reactor {
main reactor {
server = new WebServer(path="/addone")
handler = new Handler()
server.request -> handler.request
Expand Down
10 changes: 5 additions & 5 deletions examples/Python/src/lib/WebServer.lf
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ target Python {
*
* The `path` parameter is the path at which the server listens for HTTP POST requests.
*
* The `request` output is a list of two values: the request ID and the request data. If the
* request header indicates that the body is a JSON object, the request data is parsed into a python
* The `request` output is a list of two values: the request ID and the request data. If the request
* header indicates that the body is a JSON object, the request data is parsed into a python
* dictionary. Otherwise, the request body is forwarded as-is.
*
* The `response` input is a list of two values: the request ID and the response data. Request ID
* is required to respond to the correct request. Use a physical connection to connect the
* `response` input to avoid STP violations.
* The `response` input is a list of two values: the request ID and the response data. Request ID is
* required to respond to the correct request. Use a physical connection to connect the `response`
* input to avoid STP violations.
*
* To use this reactor, you must install the fastapi and uvicorn libraries for Python. You can do
* this with `pip install fastapi uvicorn`.
Expand Down

0 comments on commit 0f9aa8c

Please sign in to comment.