Katana ML Skipper Web API
Web API implements external access endpoints. Clients can trigger actions in the workflow through this API. It runs async and sync endpoints. Async endpoint is executed through Celery Distributed Queue. When async task is started, API returns task ID. Using this task ID, we can check task status and get result when ready. Sync task sends event through RabbitMQ RPC and waits for the response.
To make the API generic, there is a Worklow service, called through Requests. Based on request type, it returns queue name, where event should be sent.
File Structure
.
- models.py
- router.py
- tasks.py
- worker.py
- endpoint.py
- Dockerfile
- README.md
- api-pod.yaml
- api-celery-pod.yaml
- api-ingress.yaml
- requirements.txt
api
Instructions
To run all services, check instructions in Getting Started
Run the service without Docker
- Install libraries
- Start FastAPI
- Start Celery task distributed queue
- Web API FastAPI endpoints
pip install -r requirements.txt
uvicorn endpoint:app --reload
celery -A api.worker worker --loglevel=INFO
http://localhost:8000/api/v1/skipper/tasks/docs
Build individual container
- Build container
docker build --tag katanaml/skipper-api .
docker build --tag katanaml/skipper-api-celery .
Build and run Kubernetes Pod for API
- Create namespace
- Create Pod
- Check Pod status
- Describe Pod
- Open Pod port for testing purposes
- Open Pod logs
- Test URL
- Check Pod service
- Delete Deployment
- Delete all resources
kubectl create ns katana-skipper
kubectl apply -n katana-skipper -f api-pod.yaml
kubectl get -n katana-skipper pods
kubectl describe -n katana-skipper pods skipper-api
kubectl port-forward -n katana-skipper deploy/skipper-api 8000:8000
kubectl logs -n katana-skipper -f -l app=skipper-api
http://localhost:8000/api/v1/skipper/tasks/docs
kubectl get -n katana-skipper svc skipper-api
kubectl delete -n katana-skipper -f api-pod.yaml
kubectl delete all --all -n katana-skipper
Build and run Kubernetes Pod for API Celery
- Create namespace
- Create Pod
- Check Pod status
- Describe Pod
- Open Pod logs
- Delete Deployment
- Delete all resources
kubectl create ns katana-skipper
kubectl apply -n katana-skipper -f api-celery-pod.yaml
kubectl get -n katana-skipper pods
kubectl describe -n katana-skipper pods skipper-api-celery
kubectl logs -n katana-skipper -f -l app=skipper-api-celery
kubectl delete -n katana-skipper -f api-celery-pod.yaml
kubectl delete all --all -n katana-skipper
License
Licensed under the Apache License, Version 2.0. Copyright 2020-2021 Katana ML, Andrej Baranovskij. Copy of the license.