-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (92 loc) · 3.49 KB
/
Makefile
File metadata and controls
116 lines (92 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Prescale - Makefile for common operations
# Run 'make help' to see available commands
.PHONY: help install dev up down build test clean lint
# Default target
help:
@echo "Prescale Development Commands"
@echo "============================"
@echo ""
@echo "Local Development:"
@echo " make install - Install Python dependencies"
@echo " make dev - Start inference service locally (no Docker)"
@echo " make up - Start all services with Docker Compose"
@echo " make down - Stop Docker Compose services"
@echo " make build - Build Docker images"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests"
@echo " make test-api - Test API endpoints"
@echo " make lint - Run linters"
@echo ""
@echo "Kubernetes:"
@echo " make k8s-apply - Apply Kubernetes manifests"
@echo " make k8s-delete - Delete Kubernetes resources"
@echo ""
@echo "Utilities:"
@echo " make clean - Remove build artifacts"
@echo " make agent - Run Prescale agent locally"
# ============================================================================
# Local Development
# ============================================================================
install:
python -m pip install --upgrade pip
pip install -e ./agent[dev]
pip install -r ml/inference/requirements.txt
dev:
cd ml && python -m uvicorn inference.app:app --host 0.0.0.0 --port 8080 --reload
agent:
cd agent && python -m prescale_agent run --config ../prescale-agent.yaml
# ============================================================================
# Docker Compose
# ============================================================================
up:
docker compose up -d inference
up-all:
docker compose --profile monitoring up -d
down:
docker compose down
build:
docker compose build
logs:
docker compose logs -f inference
# ============================================================================
# Testing
# ============================================================================
test:
pytest ml/tests/ agent/tests/ -v
test-api:
@echo "Testing health endpoint..."
curl -s http://localhost:8080/health | python -m json.tool
@echo ""
@echo "Testing ready endpoint..."
curl -s http://localhost:8080/ready | python -m json.tool
@echo ""
@echo "Testing predict endpoint..."
curl -s -X POST http://localhost:8080/predict \
-H "Content-Type: application/json" \
-d '{"deployment": "test", "namespace": "default", "metric": "cpu_utilization"}' | python -m json.tool
lint:
ruff check ml/ agent/
ruff format --check ml/ agent/
format:
ruff format ml/ agent/
# ============================================================================
# Kubernetes
# ============================================================================
k8s-apply:
kubectl apply -f infra/kubernetes/prescale-inference/
k8s-delete:
kubectl delete -f infra/kubernetes/prescale-inference/
k8s-logs:
kubectl logs -n prescale -l app.kubernetes.io/name=prescale-inference -f
k8s-status:
kubectl get pods,svc,deploy -n prescale
# ============================================================================
# Cleanup
# ============================================================================
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf .ruff_cache build dist