Skip to content

Commit

Permalink
fix: update scripts for compatibility with CI infrastructure (#74)
Browse files Browse the repository at this point in the history
- Enhance path handling in minikube and router scripts
- Update workflow configurations for better reliability
- Fix Python dependencies and test requirements
- Improve test environment setup and execution

Signed-off-by: Sozhan Natarajan <[email protected]>
  • Loading branch information
Sozhan308 committed Feb 9, 2025
1 parent 3821da0 commit 8cf8631
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/router-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -44,4 +44,4 @@ jobs:
ghcr.io/${{ github.repository }}/router:latest
ghcr.io/${{ github.repository }}/router:${{ steps.version.outputs.version }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/router:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/router:buildcache,mode=max
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/router:buildcache,mode=max
28 changes: 19 additions & 9 deletions .github/workflows/router-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10 # Used similar to Dockerfile
python-version: "3.10.13"
cache: pip

- name: Login to Github Container Registry
Expand All @@ -42,10 +42,17 @@ jobs:
pip install -r requirements-test.txt
pip install -e .
- name: Make scripts executable
run: |
chmod +x ./utils/install-minikube-cluster.sh
chmod +x ./utils/install-kubectl.sh
chmod +x ./utils/install-helm.sh
chmod +x src/vllm_router/perf-test.sh
chmod +x src/tests/perftest/*.sh
- name: Setup Test environment
run: |
./utils/install-minikube-cluster.sh
./utils/install-kubectl.sh
- name: Build and Load test Image
run: |
Expand All @@ -56,23 +63,27 @@ jobs:
- name: Start Mock OpenAI servers
working-directory: src/tests/perftest
run: |
bash run-multi-server.sh 4 500 &
# Wait for servers to be ready
bash run-multi-server.sh 4 500
sleep 10
# Verify servers are running
pgrep -f fake_openai_server.py
- name: Start Router for Testing
run: |
bash src/vllm_router/perf-test.sh 8000 &
# Wait for router to be ready
sleep 5
- name: Run Performance tests
working-directory: src/tests/perftest
env:
PYTHONPATH: ${{ github.workspace }}
run: |
echo "PYTHONPATH=$PYTHONPATH"
mkdir -p logs
python3 request_generator.py --qps 10 --num-workers 32 --duration 300 > logs/request_generator.log 2>&1
if [ ! -f "request_generator.py" ]; then
echo "Error: request_generator.py not found!"
exit 1
fi
# Run with Python debug option
python3 -v request_generator.py --qps 10 --num-workers 32 --duration 300 2>&1 | tee logs/request_generator.log
- name: Run E2E Tests
run: |
Expand All @@ -93,4 +104,3 @@ jobs:
~/.kube/config
/tmp/minikube.log
src/tests/perftest/logs
1 change: 1 addition & 0 deletions src/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fastapi
httpx
uvicorn
vllm
6 changes: 5 additions & 1 deletion src/vllm_router/perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ if [[ $# -ne 1 ]]; then
exit 1
fi

python3 router.py --port "$1" \
# Get the directory where the script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Run router.py from the correct directory
python3 "$SCRIPT_DIR/router.py" --port "$1" \
--service-discovery static \
--static-backends "http://localhost:9004,http://localhost:9001,http://localhost:9002,http://localhost:9003" \
--static-models "fake_model_name,fake_model_name,fake_model_name,fake_model_name" \
Expand Down
47 changes: 31 additions & 16 deletions utils/install-minikube-cluster.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ minikube_exists() {
command -v minikube >/dev/null 2>&1
}

# Get script directory for relative paths
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Install kubectl and helm
bash ./install-kubectl.sh
bash ./install-helm.sh
bash "$SCRIPT_DIR/install-kubectl.sh"
bash "$SCRIPT_DIR/install-helm.sh"

# Install minikube
if minikube_exists; then
Expand All @@ -17,20 +20,32 @@ else
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
fi

echo "net.core.bpf_jit_harden=0" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# Install nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker
# Configure BPF if available
if [ -f /proc/sys/net/core/bpf_jit_harden ]; then
echo "net.core.bpf_jit_harden=0" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
else
echo "BPF JIT hardening configuration not available, skipping..."
fi

# Start cluster
sudo minikube start --driver docker --container-runtime docker --gpus all --force --addons=nvidia-device-plugin
# Check if NVIDIA GPU is available
if command -v nvidia-smi &> /dev/null; then
# Install nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker

# Install gpu-operator
sudo helm repo add nvidia https://helm.ngc.nvidia.com/nvidia \
&& sudo helm repo update
# Start cluster with GPU support
minikube start --driver docker --container-runtime docker --gpus all --force --addons=nvidia-device-plugin

sudo helm install --wait --generate-name \
-n gpu-operator --create-namespace \
nvidia/gpu-operator \
--version=v24.9.1
# Install gpu-operator
sudo helm repo add nvidia https://helm.ngc.nvidia.com/nvidia && sudo helm repo update
sudo helm install --wait --generate-name \
-n gpu-operator --create-namespace \
nvidia/gpu-operator \
--version=v24.9.1
else
echo "No NVIDIA GPU detected, starting minikube without GPU support..."
# Fix permission issues
sudo sysctl fs.protected_regular=0
# Start cluster without GPU
minikube start --driver docker --force
fi

0 comments on commit 8cf8631

Please sign in to comment.