-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (86 loc) · 2.57 KB
/
Copy pathMakefile
File metadata and controls
120 lines (86 loc) · 2.57 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
117
118
119
120
# Define Python executable
PYTHON = python3
# Data Preparation: Load and process features
prepare:
@echo "Preparing data..."
@$(PYTHON) main.py --prepare
# Train the model
train:
@echo "Training..."
@$(PYTHON) main.py --train
# Evaluate the model
evaluate:
@echo "Evaluating saved model..."
@$(PYTHON) main.py --evaluate
# Run the full pipeline (prepare → train → evaluate → save)
all: prepare train evaluate
# Start Jupyter Notebook
notebook:
@echo "Launching Jupyter Notebook..."
@jupyter notebook
fastapi:
uvicorn app:app --reload
mlflow:
@echo "Launching MLflow"
@mlflow server --backend-store-uri sqlite:///mlflow.db --host 0.0.0.0 --port 5000 &
@sleep 2 && open http://127.0.0.1:5000
# Build Docker Compose Services (includes FastAPI)
docker-build:
@echo "Building services defined in docker-compose.yml..."
@docker compose build
# Push to Docker Hub
docker-push:
@read -p " Enter tag (e.g. v1.0, dev): " tag; \
echo " Building image with tag: $$tag"; \
docker build -t firasrid/firas-ridene-4data-mlops:$$tag .; \
echo " Pushing $$tag and latest to Docker Hub..."; \
docker push firasrid/firas-ridene-4data-mlops:$$tag; \
# Clean up cached files
clean:
@echo "Cleaning up cache and old files..."
rm -rf __pycache__ .pytest_cache *.pkl *.log
# Run Black (formatting) via pre-commita
format:
@echo "🖌️ Formatting code with Black..."
@pre-commit run black --all-files
# Run Flake8 (linting) via pre-commit
lint:
@echo "🔍 Running Flake8..."
@pre-commit run flake8 --all-files
# Run both (Black + Flake8)
check:
@echo "🔍 Running Linting & Formatting..."
@pre-commit run --all-files
# Start only the PostgreSQL service
db:
@echo "🟢 Starting PostgreSQL container (Docker Compose)..."
docker compose up db
# Stop and remove all containers from docker-compose
docker-down:
@echo "🛑 Shutting down all Docker Compose services..."
docker compose down
services-up:
docker compose up -d elasticsearch kibana db mlflow
start:
make services-up
uvicorn app:app --reload
# 🚨 Monitor system resources (CPU/RAM)
monitor-alerts:
@echo "📢 Starting system resource monitor..."
@python3 ciservices/notify_monitor.py
ci:
@echo "🚀 Running CI pipeline..."
@{ \
make monitor-alerts > monitor.log 2>&1 & \
MON_PID=$$!; \
make check; \
make all; \
kill $$MON_PID; \
}
live_check:
./ciservices/ci_watch.sh
security-audit:
@echo "🔐 Running security audit..."
@bandit -r . -x qos,venv,__pycache__
htop:
@htop