Logo v1.0.0
  • GitHub
  • Katana ML
Logo v1.0.0
  • Documentation
  • Introduction
  • Skipper
  • Getting Started
  • API
  • Workflow
  • Services
  • RabbitMQ
  • Skipper Lib
  • Logger

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

.
    api
    • 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

Instructions

To run all services, check instructions in Getting Started

Run the service without Docker

  1. Install libraries
  2. pip install -r requirements.txt
  3. Start FastAPI
  4. uvicorn endpoint:app --reload
  5. Start Celery task distributed queue
  6. celery -A api.worker worker --loglevel=INFO
  7. Web API FastAPI endpoints
  8. http://localhost:8000/api/v1/skipper/tasks/docs

Build individual container

  1. Build container
  2. docker build --tag katanaml/skipper-api .
    docker build --tag katanaml/skipper-api-celery .

Build and run Kubernetes Pod for API

  1. Create namespace
  2. kubectl create ns katana-skipper
  3. Create Pod
  4. kubectl apply -n katana-skipper -f api-pod.yaml
  5. Check Pod status
  6. kubectl get -n katana-skipper pods
  7. Describe Pod
  8. kubectl describe -n katana-skipper pods skipper-api
  9. Open Pod port for testing purposes
  10. kubectl port-forward -n katana-skipper deploy/skipper-api 8000:8000
  11. Open Pod logs
  12. kubectl logs -n katana-skipper -f -l app=skipper-api
  13. Test URL
  14. http://localhost:8000/api/v1/skipper/tasks/docs
  15. Check Pod service
  16. kubectl get -n katana-skipper svc skipper-api
  17. Delete Deployment
  18. kubectl delete -n katana-skipper -f api-pod.yaml
  19. Delete all resources
  20. kubectl delete all --all -n katana-skipper

Build and run Kubernetes Pod for API Celery

  1. Create namespace
  2. kubectl create ns katana-skipper
  3. Create Pod
  4. kubectl apply -n katana-skipper -f api-celery-pod.yaml
  5. Check Pod status
  6. kubectl get -n katana-skipper pods
  7. Describe Pod
  8. kubectl describe -n katana-skipper pods skipper-api-celery
  9. Open Pod logs
  10. kubectl logs -n katana-skipper -f -l app=skipper-api-celery
  11. Delete Deployment
  12. kubectl delete -n katana-skipper -f api-celery-pod.yaml
  13. Delete all resources
  14. 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.