Files
ai-agent-book/chapter3/retrieval-pipeline/restart_services.sh
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

69 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Script to restart all services for the retrieval pipeline
# Run this from the retrieval-pipeline directory
echo "Restarting all retrieval pipeline services..."
echo "============================================"
# Kill existing services if running
echo "Stopping existing services..."
pkill -f "python.*server.py" 2>/dev/null
pkill -f "python.*main.py" 2>/dev/null
# Kill old ports if any still running
pkill -f "uvicorn.*8000" 2>/dev/null
pkill -f "uvicorn.*8001" 2>/dev/null
pkill -f "uvicorn.*4242" 2>/dev/null
pkill -f "uvicorn.*8003" 2>/dev/null
# Kill new ports
pkill -f "uvicorn.*4240" 2>/dev/null
pkill -f "uvicorn.*4241" 2>/dev/null
pkill -f "uvicorn.*4242" 2>/dev/null
sleep 2
# Start dense embedding service
echo ""
echo "Starting Dense Embedding Service (port 4240)..."
cd ../dense-embedding
python main.py --port 4240 > dense.log 2>&1 &
DENSE_PID=$!
echo "Dense service started with PID: $DENSE_PID"
sleep 3
# Start sparse embedding service
echo ""
echo "Starting Sparse Embedding Service (port 4241)..."
cd ../sparse-embedding
python server.py 4241 > sparse.log 2>&1 &
SPARSE_PID=$!
echo "Sparse service started with PID: $SPARSE_PID"
sleep 3
# Start retrieval pipeline service
echo ""
echo "Starting Retrieval Pipeline Service (port 4242)..."
cd ../retrieval-pipeline
python main.py --port 4242 > pipeline.log 2>&1 &
PIPELINE_PID=$!
echo "Pipeline service started with PID: $PIPELINE_PID"
sleep 5
echo ""
echo "All services started!"
echo "====================="
echo "Dense service: http://localhost:4240 (PID: $DENSE_PID)"
echo "Sparse service: http://localhost:4241 (PID: $SPARSE_PID)"
echo "Pipeline service: http://localhost:4242 (PID: $PIPELINE_PID)"
echo ""
echo "Logs are being written to:"
echo " - dense.log (in dense-embedding/)"
echo " - sparse.log (in sparse-embedding/)"
echo " - pipeline.log (in retrieval-pipeline/)"
echo ""
echo "To test the pipeline, run: python test_pipeline.py"
echo "To stop all services, run: pkill -f 'python.*server.py|python.*main.py'"