|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "===================================================" |
|
|
echo "🚀 Starting ModelX Anomaly Detection Pipeline" |
|
|
echo "===================================================" |
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
|
|
cd "$SCRIPT_DIR" |
|
|
|
|
|
|
|
|
echo "[1/3] Checking dependencies..." |
|
|
if [ ! -f "models/anomaly-detection/models_cache/lid.176.bin" ]; then |
|
|
echo "⚠️ WARNING: FastText model not found in models/anomaly-detection/models_cache/" |
|
|
echo " Please download it from: https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin" |
|
|
fi |
|
|
|
|
|
|
|
|
echo "[2/3] Starting Vectorization Agent API..." |
|
|
echo " - Port: 8001" |
|
|
echo " - Log: vectorization_api.log" |
|
|
|
|
|
|
|
|
nohup python src/api/vectorization_api.py > vectorization_api.log 2>&1 & |
|
|
API_PID=$! |
|
|
echo " ✅ API started with PID: $API_PID" |
|
|
|
|
|
|
|
|
echo " ⏳ Waiting for API to initialize..." |
|
|
sleep 5 |
|
|
|
|
|
|
|
|
echo "[3/3] Starting Apache Airflow (Astro)..." |
|
|
echo " - Dashboard: http://localhost:8080" |
|
|
echo " - DAGs: models/anomaly-detection/dags" |
|
|
|
|
|
cd models/anomaly-detection |
|
|
|
|
|
|
|
|
if ! command -v astro &> /dev/null; then |
|
|
echo "❌ Error: 'astro' command not found. Please install Astronomer CLI." |
|
|
echo " Skipping Airflow, but API is still running." |
|
|
echo "" |
|
|
echo "Press Ctrl+C to stop the API..." |
|
|
wait $API_PID |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
|
|
|
if [ ! -f "Dockerfile" ]; then |
|
|
echo "⚠️ Astro project not initialized. Running 'astro dev init'..." |
|
|
astro dev init --name anomaly-detection |
|
|
fi |
|
|
|
|
|
|
|
|
astro dev start --no-browser |
|
|
|
|
|
|
|
|
echo "" |
|
|
echo "🛑 Stopping services..." |
|
|
kill $API_PID 2>/dev/null |
|
|
echo "✅ Services stopped." |
|
|
|