Closed mdo6180 closed 2 weeks ago
Created healthcheck by implementing healthcheck as python file. Python file call os._exit(status=0)
to ensure script exits with status 0. Docker compose looks for exit status 0 from a shell command as passing condition for healthcheck.
i'm going to stop using docker
and docker compose
because docker consumes too much memory (i literally ran out of ram to build the containers).
thus, i have decided to make the switch to bash scripts to set up the tests.
the following code snippet is an example of how to assign IP addresses and ports to FastAPI
servers using bash.
#!/bin/bash
# Define IP addresses and ports
IP1="192.168.100.1"
IP2="192.168.100.2"
PORT1="8001"
PORT2="8002"
# Create network namespaces
sudo ip netns add ns1
sudo ip netns add ns2
# Create veth pairs
sudo ip link add veth0 type veth peer name veth1
sudo ip link add veth2 type veth peer name veth3
# Assign one end of each veth pair to the respective namespace
sudo ip link set veth1 netns ns1
sudo ip link set veth3 netns ns2
# Assign IP addresses to the veth interfaces
sudo ip addr add $IP1/24 dev veth0
sudo ip netns exec ns1 ip addr add $IP1/24 dev veth1
sudo ip addr add $IP2/24 dev veth2
sudo ip netns exec ns2 ip addr add $IP2/24 dev veth3
# Bring up the interfaces
sudo ip link set veth0 up
sudo ip link set veth2 up
sudo ip netns exec ns1 ip link set veth1 up
sudo ip netns exec ns2 ip link set veth3 up
# Start FastAPI servers
# Run app1 in the first namespace
sudo ip netns exec ns1 uvicorn app1:app --host $IP1 --port $PORT1 &
# Run app2 in the second namespace
sudo ip netns exec ns2 uvicorn app2:app --host $IP2 --port $PORT2 &
# Output the completion message
echo "FastAPI servers are running at:"
echo "http://$IP1:$PORT1 (in namespace ns1)"
echo "http://$IP2:$PORT2 (in namespace ns2)"
GraphService
Pipeline
class toGraph
Webserver
class toGraphServer
GraphServer
handles all web traffic for aGraph
. This includes:Graph
.Graph
is assigned a "GraphID
"GraphServer
is the "main app" that sub apps get mounted into (each node has its own sub-app).GraphService
is bound to a specific ip address and portGraphServer
uses theGraph
class to spin up a copy of the subgraph.GraphService
spins up an instance ofGraphServer
and assigns an endpoint prefix to theGraphServer
.GraphServer
is then mounted intoGraphService
.GraphService
:RootGraphService
serves a graph that has a metadata store.LeafGraphService
serves a graph that does not have a metadata store.Test outline:
docker compose
and call the python file that creates dummy files for testing and puts the dummy files into the repositories mounted into the container runningRootGraphService
RootGraphService
and the other container spins up aLeafGraphService
.RootGraphService
contains metadata store node, monitoring resource node, and action nodeLeafGraphService
contains an action node.RootGraphService
and theLeafGraphService
are both triggered.Testing logging configurations
GraphService
to accept loggersGraphService
.pip install -e
command to install Anacostia inside the container.input_artifacts
).output_artifacts
).