Place for studying and experimenting with FastAPI
pip install -r requirements.txt
- Run the API on terminal
uvicorn etl_api:app --reload --host=127.0.0.1 --port=9999
-
Goto the APIHub Page: localhost:9999/docs
-
Run the apitest:
python test_execution.py
-
Run the colab notebook: ColabFastAPI.ipynb
-
Replace the api url in
test_colab_execution.py
with that shown in the last cell of colab:
e.g., Colab api url: http://c26c-35-245-61-122.ngrok.io
- On local terminal, execute
test_colab_execution.py
- Build a image with ray serving
docker build -t ray_server .
- Run the image as container and start the API inside
docker run -it -p 9999:9999 --shm-size=4.80gb --rm ray_server bash
- Run start.sh in the container
redis-server &
echo 'redis started'
env RAY_LOG_TO_STDERR=1 ray start --head --port=7000 --redis-shard-ports=6379
sleep 20
uvicorn executor_api:app --host 172.17.0.2 --port 9999
- Build an router api that connect the in-container API to the outside world
follow REF: https://docs.ray.io/en/master/ray-overview/installation.html#m1-mac-apple-silicon-support
pip install -r requirements.txt
ray start --head
python etl_api.py