This repo creates FastAPI apis and connect them to temporal server to execute workflows. FastAPI server is connected in local host, temporal server is run in docker compose but is pointed to localhost. Api requests can be sent from command line to start workflow or query workflow progress.
ChatGPT is utilized to learn about FastAPI, Temporal and Docker. It is also utilized to learn how to build workers,workflows,activites and for debugging.
- Python 3+
- Docker & Docker Compose
pip(Python package manager)
git clone <repo-url>
python -m venv venv
source venv/bin/activate (macOS/Linux)
or
venv\Scripts\activate (Windows)
pip install --upgrade pip
pip install -r requirements.txt
docker-compose up -d
docker ps
python worker/worker.py
uvicorn api.main:app --reload
curl -X POST http://127.0.0.1:8000/jobs \
-H "Content-Type: application/json" \
-d '{"input":{"numbers":[1,2,3,4]},"options":{"fail_first_attempt":true}}'
curl http://127.0.0.1:8000/jobs/job-<id>
